|
|
|
@ -500,7 +500,7 @@ class CollectionBuilder:
|
|
|
|
|
logger.debug("")
|
|
|
|
|
logger.debug("Validating Method: collection_order")
|
|
|
|
|
if self.data[methods["collection_order"]] is None:
|
|
|
|
|
raise Failed(f"Collection Warning: collection_order attribute is blank")
|
|
|
|
|
raise Failed(f"{self.Type} Warning: collection_order attribute is blank")
|
|
|
|
|
else:
|
|
|
|
|
logger.debug(f"Value: {self.data[methods['collection_order']]}")
|
|
|
|
|
if self.data[methods["collection_order"]].lower() in plex.collection_order_options:
|
|
|
|
@ -667,11 +667,12 @@ class CollectionBuilder:
|
|
|
|
|
else:
|
|
|
|
|
logger.error(e)
|
|
|
|
|
|
|
|
|
|
if self.custom_sort and len(self.builders) > 1:
|
|
|
|
|
raise Failed(f"{self.Type} Error: collection_order: custom can only be used with a single builder per collection")
|
|
|
|
|
if self.custom_sort and (len(self.builders) > 1 or self.builders[0][0] not in custom_sort_builders):
|
|
|
|
|
raise Failed(f"{self.Type} Error: " + ('Playlists' if playlist else 'collection_order: custom') +
|
|
|
|
|
(f" can only be used with a single builder per {self.type}" if len(self.builders) > 1 else f" cannot be used with {self.builders[0][0]}"))
|
|
|
|
|
|
|
|
|
|
if self.custom_sort and self.builders[0][0] not in custom_sort_builders:
|
|
|
|
|
raise Failed(f"{self.Type} Error: collection_order: custom cannot be used with {self.builders[0][0]}")
|
|
|
|
|
if len(self.builders) == 0:
|
|
|
|
|
raise Failed(f"{self.Type} Error: No builders were found")
|
|
|
|
|
|
|
|
|
|
if "add" not in self.radarr_details:
|
|
|
|
|
self.radarr_details["add"] = self.library.Radarr.add if self.library.Radarr else False
|
|
|
|
@ -1309,50 +1310,50 @@ class CollectionBuilder:
|
|
|
|
|
else:
|
|
|
|
|
logger.error(message)
|
|
|
|
|
|
|
|
|
|
def find_rating_keys(self):
|
|
|
|
|
for method, value in self.builders:
|
|
|
|
|
ids = []
|
|
|
|
|
rating_keys = []
|
|
|
|
|
logger.debug("")
|
|
|
|
|
logger.debug(f"Builder: {method}: {value}")
|
|
|
|
|
logger.info("")
|
|
|
|
|
def gather_ids(self, method, value):
|
|
|
|
|
if "plex" in method:
|
|
|
|
|
rating_keys = self.library.get_rating_keys(method, value)
|
|
|
|
|
return self.library.get_rating_keys(method, value)
|
|
|
|
|
elif "tautulli" in method:
|
|
|
|
|
rating_keys = self.library.Tautulli.get_rating_keys(self.library, value)
|
|
|
|
|
return self.library.Tautulli.get_rating_keys(self.library, value)
|
|
|
|
|
elif "anidb" in method:
|
|
|
|
|
anidb_ids = self.config.AniDB.get_anidb_ids(method, value, self.language)
|
|
|
|
|
ids = self.config.Convert.anidb_to_ids(anidb_ids, self.library)
|
|
|
|
|
return self.config.Convert.anidb_to_ids(anidb_ids, self.library)
|
|
|
|
|
elif "anilist" in method:
|
|
|
|
|
anilist_ids = self.config.AniList.get_anilist_ids(method, value)
|
|
|
|
|
ids = self.config.Convert.anilist_to_ids(anilist_ids, self.library)
|
|
|
|
|
return self.config.Convert.anilist_to_ids(anilist_ids, self.library)
|
|
|
|
|
elif "mal" in method:
|
|
|
|
|
mal_ids = self.config.MyAnimeList.get_mal_ids(method, value)
|
|
|
|
|
ids = self.config.Convert.myanimelist_to_ids(mal_ids, self.library)
|
|
|
|
|
return self.config.Convert.myanimelist_to_ids(mal_ids, self.library)
|
|
|
|
|
elif "tvdb" in method:
|
|
|
|
|
ids = self.config.TVDb.get_tvdb_ids(method, value)
|
|
|
|
|
return self.config.TVDb.get_tvdb_ids(method, value)
|
|
|
|
|
elif "imdb" in method:
|
|
|
|
|
ids = self.config.IMDb.get_imdb_ids(method, value, self.language)
|
|
|
|
|
return self.config.IMDb.get_imdb_ids(method, value, self.language)
|
|
|
|
|
elif "flixpatrol" in method:
|
|
|
|
|
ids = self.config.FlixPatrol.get_flixpatrol_ids(method, value, self.language, self.library.is_movie)
|
|
|
|
|
return self.config.FlixPatrol.get_flixpatrol_ids(method, value, self.language, self.library.is_movie)
|
|
|
|
|
elif "icheckmovies" in method:
|
|
|
|
|
ids = self.config.ICheckMovies.get_icheckmovies_ids(method, value, self.language)
|
|
|
|
|
return self.config.ICheckMovies.get_icheckmovies_ids(method, value, self.language)
|
|
|
|
|
elif "letterboxd" in method:
|
|
|
|
|
ids = self.config.Letterboxd.get_tmdb_ids(method, value, self.language)
|
|
|
|
|
return self.config.Letterboxd.get_tmdb_ids(method, value, self.language)
|
|
|
|
|
elif "stevenlu" in method:
|
|
|
|
|
ids = self.config.StevenLu.get_stevenlu_ids(method)
|
|
|
|
|
return self.config.StevenLu.get_stevenlu_ids(method)
|
|
|
|
|
elif "tmdb" in method:
|
|
|
|
|
ids = self.config.TMDb.get_tmdb_ids(method, value, self.library.is_movie)
|
|
|
|
|
return self.config.TMDb.get_tmdb_ids(method, value, self.library.is_movie)
|
|
|
|
|
elif "trakt" in method:
|
|
|
|
|
ids = self.config.Trakt.get_trakt_ids(method, value, self.library.is_movie)
|
|
|
|
|
return self.config.Trakt.get_trakt_ids(method, value, self.library.is_movie)
|
|
|
|
|
else:
|
|
|
|
|
logger.error(f"{self.Type} Error: {method} method not supported")
|
|
|
|
|
|
|
|
|
|
if len(ids) > 0:
|
|
|
|
|
def find_rating_keys(self):
|
|
|
|
|
for method, value in self.builders:
|
|
|
|
|
logger.debug("")
|
|
|
|
|
logger.debug(f"{len(ids)} IDs Found: {ids}")
|
|
|
|
|
logger.debug(f"Builder: {method}: {value}")
|
|
|
|
|
logger.info("")
|
|
|
|
|
rating_keys = []
|
|
|
|
|
ids = self.gather_ids(method, value)
|
|
|
|
|
if len(ids) > 0:
|
|
|
|
|
total_ids = len(ids)
|
|
|
|
|
if total_ids > 0:
|
|
|
|
|
logger.debug("")
|
|
|
|
|
logger.debug(f"{total_ids} IDs Found: {ids}")
|
|
|
|
|
for i, input_data in enumerate(ids, 1):
|
|
|
|
|
input_id, id_type = input_data
|
|
|
|
|
util.print_return(f"Parsing ID {i}/{total_ids}")
|
|
|
|
@ -1380,8 +1381,7 @@ class CollectionBuilder:
|
|
|
|
|
if input_id not in self.ignore_imdb_ids:
|
|
|
|
|
if input_id in self.library.imdb_map:
|
|
|
|
|
rating_keys.extend(self.library.imdb_map[input_id])
|
|
|
|
|
else:
|
|
|
|
|
if self.do_missing:
|
|
|
|
|
elif self.do_missing:
|
|
|
|
|
try:
|
|
|
|
|
tmdb_id, tmdb_type = self.config.Convert.imdb_to_tmdb(input_id, fail=True)
|
|
|
|
|
if tmdb_type == "movie":
|
|
|
|
@ -1400,8 +1400,8 @@ class CollectionBuilder:
|
|
|
|
|
if show_id in self.library.show_map:
|
|
|
|
|
show_item = self.library.fetchItem(self.library.show_map[show_id][0])
|
|
|
|
|
try:
|
|
|
|
|
episode_item = show_item.season(season=int(season_num))
|
|
|
|
|
rating_keys.append(episode_item.ratingKey)
|
|
|
|
|
season_item = show_item.season(season=int(season_num))
|
|
|
|
|
rating_keys.append(season_item.ratingKey)
|
|
|
|
|
except NotFound:
|
|
|
|
|
self.missing_parts.append(f"{show_item.title} Season: {season_num} Missing")
|
|
|
|
|
elif show_id not in self.missing_shows:
|
|
|
|
|