@ -408,8 +408,16 @@ class Config:
logger . info ( " " )
logger . info ( " " )
util . seperator ( " {} Collection " . format ( c ) )
util . seperator ( " {} Collection " . format ( c ) )
logger . info ( " " )
logger . info ( " " )
map = { }
details = { }
methods = [ ]
filters = [ ]
posters_found = [ ]
backgrounds_found = [ ]
collectionless = " plex_collectionless " in collections [ c ]
collectionless = " plex_collectionless " in collections [ c ]
skip_collection = True
skip_collection = True
if " schedule " not in collections [ c ] :
if " schedule " not in collections [ c ] :
skip_collection = False
skip_collection = False
elif not collections [ c ] [ " schedule " ] :
elif not collections [ c ] [ " schedule " ] :
@ -464,18 +472,10 @@ class Config:
logger . error ( " Collection Error: failed to parse schedule: {} " . format ( schedule ) )
logger . error ( " Collection Error: failed to parse schedule: {} " . format ( schedule ) )
else :
else :
logger . error ( " Collection Error: schedule attribute {} invalid " . format ( schedule ) )
logger . error ( " Collection Error: schedule attribute {} invalid " . format ( schedule ) )
if skip_collection :
if skip_collection :
logger . info ( " Skipping Collection {} " . format ( c ) )
logger . info ( " Skipping Collection {} " . format ( c ) )
continue
continue
map = { }
details = { }
methods = [ ]
filters = [ ]
posters_found = [ ]
backgrounds_found = [ ]
try :
try :
collection_obj = library . get_collection ( c )
collection_obj = library . get_collection ( c )
collection_name = collection_obj . title
collection_name = collection_obj . title
@ -483,7 +483,6 @@ class Config:
collection_obj = None
collection_obj = None
collection_name = c
collection_name = c
sync_collection = library . sync_mode == " sync "
sync_collection = library . sync_mode == " sync "
if " sync_mode " in collections [ c ] :
if " sync_mode " in collections [ c ] :
if not collections [ c ] [ " sync_mode " ] : logger . warning ( " Collection Warning: sync_mode attribute is blank using general: {} " . format ( library . sync_mode ) )
if not collections [ c ] [ " sync_mode " ] : logger . warning ( " Collection Warning: sync_mode attribute is blank using general: {} " . format ( library . sync_mode ) )
@ -497,6 +496,25 @@ class Config:
else :
else :
logger . info ( " Sync Mode: append " )
logger . info ( " Sync Mode: append " )
if " tmdb_person " in collections [ c ] :
if collections [ c ] [ " tmdb_person " ] :
valid_names = [ ]
for tmdb_id in util . get_int_list ( collections [ c ] [ " tmdb_person " ] , " TMDb Person ID " ) :
try :
person = self . TMDb . get_person ( tmdb_id )
valid_names . append ( person . name )
if " summary " not in details and hasattr ( person , " biography " ) and person . biography :
details [ " summary " ] = person . biography
if " poster " not in details and hasattr ( person , " profile_path " ) and person . profile_path :
details [ " poster " ] = ( " url " , " {} {} " . format ( self . TMDb . image_url , person . profile_path ) , " tmdb_person " )
except Failed as e :
util . print_stacktrace ( )
logger . error ( e )
if len ( valid_names ) > 0 : details [ " tmdb_person " ] = valid_names
else : logger . error ( " Collection Error: No valid TMDb Person IDs in {} " . format ( collections [ c ] [ " tmdb_person " ] ) )
else :
logger . error ( " Collection Error: tmdb_person attribute is blank " )
for m in collections [ c ] :
for m in collections [ c ] :
try :
try :
if " tmdb " in m and not self . TMDb :
if " tmdb " in m and not self . TMDb :
@ -508,7 +526,7 @@ class Config:
elif " imdb " in m and not self . IMDb :
elif " imdb " in m and not self . IMDb :
logger . info ( " Collection Error: {} skipped. TMDb or Trakt must be configured " . format ( m ) )
logger . info ( " Collection Error: {} skipped. TMDb or Trakt must be configured " . format ( m ) )
map = { }
map = { }
elif m == " tautulli " and not library . Tautulli :
elif " tautulli " in m and not library . Tautulli :
logger . info ( " Collection Error: {} skipped. Tautulli must be configured " . format ( m ) )
logger . info ( " Collection Error: {} skipped. Tautulli must be configured " . format ( m ) )
map = { }
map = { }
elif " mal " in m and not self . MyAnimeList :
elif " mal " in m and not self . MyAnimeList :
@ -537,8 +555,8 @@ class Config:
if collections [ c ] [ m ] in [ " release " , " alpha " ] : details [ method_name ] = collections [ c ] [ m ]
if collections [ c ] [ m ] in [ " release " , " alpha " ] : details [ method_name ] = collections [ c ] [ m ]
else : raise Failed ( " Collection Error: {} collection_order Invalid \n | \t release (Order Collection by release dates) \n | \t alpha (Order Collection Alphabetically) " . format ( collections [ c ] [ m ] ) )
else : raise Failed ( " Collection Error: {} collection_order Invalid \n | \t release (Order Collection by release dates) \n | \t alpha (Order Collection Alphabetically) " . format ( collections [ c ] [ m ] ) )
elif method_name == " url_poster " : posters_found . append ( ( " url " , collections [ c ] [ m ] , method_name ) )
elif method_name == " url_poster " : posters_found . append ( ( " url " , collections [ c ] [ m ] , method_name ) )
elif method_name == " tmdb_poster " : posters_found . append ( ( " url " , " {} {} " . format ( self . TMDb . image_url , self . get_movie_show_or_collection( util . regex_first_int ( collections [ c ] [ m ] , " TMDb ID " ) , library . is_movie ) . poster_path ) , method_name ) )
elif method_name == " tmdb_poster " : posters_found . append ( ( " url " , " {} {} " . format ( self . TMDb . image_url , self . TMDb. get_movie_show_or_collection( util . regex_first_int ( collections [ c ] [ m ] , " TMDb ID " ) , library . is_movie ) . poster_path ) , method_name ) )
elif method_name == " tmdb_profile " : posters_found . append ( ( " url " , " {} {} " . format ( self . TMDb . image_url , self . get_person( util . regex_first_int ( collections [ c ] [ m ] , " TMDb Person ID " ) ) . profile_path ) , method_name ) )
elif method_name == " tmdb_profile " : posters_found . append ( ( " url " , " {} {} " . format ( self . TMDb . image_url , self . TMDb. get_person( util . regex_first_int ( collections [ c ] [ m ] , " TMDb Person ID " ) ) . profile_path ) , method_name ) )
elif method_name == " file_poster " :
elif method_name == " file_poster " :
if os . path . exists ( collections [ c ] [ m ] ) : posters_found . append ( ( " file " , os . path . abspath ( collections [ c ] [ m ] ) , method_name ) )
if os . path . exists ( collections [ c ] [ m ] ) : posters_found . append ( ( " file " , os . path . abspath ( collections [ c ] [ m ] ) , method_name ) )
else : raise Failed ( " Collection Error: Poster Path Does Not Exist: {} " . format ( os . path . abspath ( collections [ c ] [ m ] ) ) )
else : raise Failed ( " Collection Error: Poster Path Does Not Exist: {} " . format ( os . path . abspath ( collections [ c ] [ m ] ) ) )
@ -553,22 +571,15 @@ class Config:
elif method_name in util . all_details : details [ method_name ] = collections [ c ] [ m ]
elif method_name in util . all_details : details [ method_name ] = collections [ c ] [ m ]
elif method_name in [ " year " , " year.not " ] : methods . append ( ( " plex_search " , [ [ ( method_name , util . get_year_list ( collections [ c ] [ m ] , method_name ) ) ] ] ) )
elif method_name in [ " year " , " year.not " ] : methods . append ( ( " plex_search " , [ [ ( method_name , util . get_year_list ( collections [ c ] [ m ] , method_name ) ) ] ] ) )
elif method_name in [ " decade " , " decade.not " ] : methods . append ( ( " plex_search " , [ [ ( method_name , util . get_int_list ( collections [ c ] [ m ] , util . remove_not ( method_name ) ) ) ] ] ) )
elif method_name in [ " decade " , " decade.not " ] : methods . append ( ( " plex_search " , [ [ ( method_name , util . get_int_list ( collections [ c ] [ m ] , util . remove_not ( method_name ) ) ) ] ] ) )
elif method_name in [ " actor_details_tmdb " , " director_details_tmdb " , " writer_details_tmdb " ] :
elif method_name in util . tmdb_searches :
valid_ids = [ ]
final_values = [ ]
for tmdb_id in util . get_int_list ( collections [ c ] [ m ] , " TMDb Person ID " ) :
for value in util . get_list ( collections [ c ] [ m ] ) :
try :
if value . lower ( ) == " tmdb " and " tmdb_person " in details :
person = self . TMDb . get_person ( tmdb_id )
for name in details [ " tmdb_person " ] :
valid_ids . append ( person . name )
final_values . append ( name )
if " summary " not in details and hasattr ( person , " biography " ) and person . biography :
else :
details [ " summary " ] = person . biography
final_values . append ( value )
if " poster " not in details and hasattr ( person , " profile_path " ) and person . profile_path :
methods . append ( ( " plex_search " , [ [ ( method_name , final_values ) ] ] ) )
details [ " poster " ] = ( " url " , " {} {} " . format ( self . TMDb . image_url , person . profile_path ) , method_name )
except Failed as e :
util . print_stacktrace ( )
logger . error ( e )
if len ( valid_ids ) == 0 :
raise Failed ( " Collection Error: No valid TMDb Person IDs in {} " . format ( collections [ c ] [ m ] ) )
methods . append ( ( " plex_search " , [ [ ( method_name [ : - 13 ] , valid_ids ) ] ] ) )
elif method_name in util . plex_searches : methods . append ( ( " plex_search " , [ [ ( method_name , util . get_list ( collections [ c ] [ m ] ) ) ] ] ) )
elif method_name in util . plex_searches : methods . append ( ( " plex_search " , [ [ ( method_name , util . get_list ( collections [ c ] [ m ] ) ) ] ] ) )
elif method_name == " plex_all " : methods . append ( ( method_name , [ " " ] ) )
elif method_name == " plex_all " : methods . append ( ( method_name , [ " " ] ) )
elif method_name == " plex_collection " : methods . append ( ( method_name , library . validate_collections ( collections [ c ] [ m ] if isinstance ( collections [ c ] [ m ] , list ) else [ collections [ c ] [ m ] ] ) ) )
elif method_name == " plex_collection " : methods . append ( ( method_name , library . validate_collections ( collections [ c ] [ m ] if isinstance ( collections [ c ] [ m ] , list ) else [ collections [ c ] [ m ] ] ) ) )
@ -810,7 +821,7 @@ class Config:
else :
else :
methods . append ( ( method_name , values ) )
methods . append ( ( method_name , values ) )
elif method_name in util . all_lists : methods . append ( ( method_name , util . get_list ( collections [ c ] [ m ] ) ) )
elif method_name in util . all_lists : methods . append ( ( method_name , util . get_list ( collections [ c ] [ m ] ) ) )
elif method_name not in [ " sync_mode " , " schedule " ]: logger . error ( " Collection Error: {} attribute not supported " . format ( method_name ) )
elif method_name not in [ " sync_mode " , " schedule " , " tmdb_person " ]: logger . error ( " Collection Error: {} attribute not supported " . format ( method_name ) )
else :
else :
logger . error ( " Collection Error: {} attribute is blank " . format ( m ) )
logger . error ( " Collection Error: {} attribute is blank " . format ( m ) )
except Failed as e :
except Failed as e :