From 380ab73f525ead755be6420b0dc371c5409b40df Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 14 May 2021 15:22:59 -0400 Subject: [PATCH] fix for all movies being added to radarr --- modules/builder.py | 36 ++++++++++++++++++------------------ modules/convert.py | 4 ++-- plex_meta_manager.py | 6 +++--- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index d7f198d4..cac14c70 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -207,8 +207,8 @@ class CollectionBuilder: self.methods = [] self.filters = [] self.rating_keys = [] - self.missing_movies = [] - self.missing_shows = [] + self.run_again_movies = [] + self.run_again_shows = [] self.posters = {} self.backgrounds = {} self.summaries = {} @@ -1343,7 +1343,7 @@ class CollectionBuilder: elif "trakt" in method: check_map(self.config.Trakt.get_items(method, value, self.library.is_movie)) else: logger.error(f"Collection Error: {method} method not supported") - def add_to_collection(self, movie_map, show_map): + def add_to_collection(self, movie_map): name, collection_items = self.library.get_collection_name_and_items(self.obj if self.obj else self.name, self.smart_label_collection) total = len(self.rating_keys) max_length = len(str(total)) @@ -1466,15 +1466,15 @@ class CollectionBuilder: media_type = f"{'Movie' if self.library.is_movie else 'Show'}{'s' if total > 1 else ''}" util.print_end(length, f"{total} {media_type} Processed") - def run_missing(self, missing_movies, missing_shows): + def run_missing(self): logger.info("") arr_filters = [] for filter_method, filter_data in self.filters: if (filter_method.startswith("original_language") and self.library.is_movie) or filter_method.startswith("tmdb_vote_count"): arr_filters.append((filter_method, filter_data)) - if len(missing_movies) > 0: + if len(self.missing_movies) > 0: missing_movies_with_names = [] - for missing_id in missing_movies: + for missing_id in self.missing_movies: try: movie = self.config.TMDb.get_movie(missing_id) except Failed as e: @@ -1505,10 +1505,10 @@ class CollectionBuilder: except Failed as e: logger.error(e) if self.run_again: - self.missing_movies.extend(missing_tmdb_ids) - if len(missing_shows) > 0 and self.library.is_show: + self.run_again_movies.extend(missing_tmdb_ids) + if len(self.missing_shows) > 0 and self.library.is_show: missing_shows_with_names = [] - for missing_id in missing_shows: + for missing_id in self.missing_shows: try: title = str(self.config.TVDb.get_series(self.library.Plex.language, missing_id).title.encode("ascii", "replace").decode()) except Failed as e: @@ -1539,7 +1539,7 @@ class CollectionBuilder: except Failed as e: logger.error(e) if self.run_again: - self.missing_shows.extend(missing_tvdb_ids) + self.run_again_shows.extend(missing_tvdb_ids) def sync_collection(self): logger.info("") @@ -1739,11 +1739,11 @@ class CollectionBuilder: self.obj = self.library.get_collection(self.name) name, collection_items = self.library.get_collection_name_and_items(self.obj, self.smart_label_collection) rating_keys = [] - for mm in self.missing_movies: + for mm in self.run_again_movies: if mm in movie_map: rating_keys.extend(movie_map[mm]) if self.library.is_show: - for sm in self.missing_shows: + for sm in self.run_again_shows: if sm in show_map: rating_keys.extend(show_map[sm]) if len(rating_keys) > 0: @@ -1762,9 +1762,9 @@ class CollectionBuilder: logger.info(f"{name} Collection | + | {current.title}") logger.info(f"{len(rating_keys)} {'Movie' if self.library.is_movie else 'Show'}{'s' if len(rating_keys) > 1 else ''} Processed") - if len(self.missing_movies) > 0: + if len(self.run_again_movies) > 0: logger.info("") - for missing_id in self.missing_movies: + for missing_id in self.run_again_movies: if missing_id not in movie_map: try: movie = self.config.TMDb.get_movie(missing_id) @@ -1774,11 +1774,11 @@ class CollectionBuilder: if self.details["show_missing"] is True: logger.info(f"{name} Collection | ? | {movie.title} (TMDb: {missing_id})") logger.info("") - logger.info(f"{len(self.missing_movies)} Movie{'s' if len(self.missing_movies) > 1 else ''} Missing") + logger.info(f"{len(self.run_again_movies)} Movie{'s' if len(self.run_again_movies) > 1 else ''} Missing") - if len(self.missing_shows) > 0 and self.library.is_show: + if len(self.run_again_shows) > 0 and self.library.is_show: logger.info("") - for missing_id in self.missing_shows: + for missing_id in self.run_again_shows: if missing_id not in show_map: try: title = str(self.config.TVDb.get_series(self.library.Plex.language, missing_id).title.encode("ascii", "replace").decode()) @@ -1787,4 +1787,4 @@ class CollectionBuilder: continue if self.details["show_missing"] is True: logger.info(f"{name} Collection | ? | {title} (TVDb: {missing_id})") - logger.info(f"{len(self.missing_shows)} Show{'s' if len(self.missing_shows) > 1 else ''} Missing") + logger.info(f"{len(self.run_again_shows)} Show{'s' if len(self.run_again_shows) > 1 else ''} Missing") diff --git a/modules/convert.py b/modules/convert.py index e64aef82..7eaa939b 100644 --- a/modules/convert.py +++ b/modules/convert.py @@ -308,7 +308,7 @@ class Convert: else: tmdb_id = self.imdb_to_tmdb(imdb_id) if not tmdb_id: - raise Failed(f"Unable to convert IMDb ID: {imdb_id} to TMDb ID") + raise Failed(f"Unable to convert IMDb ID: {util.compile_list(imdb_id)} to TMDb ID") if not anidb_id and not tvdb_id and tmdb_id and library.is_show: if isinstance(tmdb_id, list): tvdb_id = [] @@ -320,7 +320,7 @@ class Convert: else: tvdb_id = self.tmdb_to_tvdb(tmdb_id) if not tvdb_id: - raise Failed(f"Unable to convert TMDb ID: {tmdb_id} to TVDb ID") + raise Failed(f"Unable to convert TMDb ID: {util.compile_list(tmdb_id)} to TVDb ID") if tvdb_id: if isinstance(tvdb_id, list): diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 808407b7..fa58744a 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -368,16 +368,16 @@ def run_collection(config, library, metadata, requested_collections, is_test, re builder.collect_rating_keys(movie_map, show_map) logger.info("") if len(builder.rating_keys) > 0: - builder.add_to_collection(movie_map, show_map) + builder.add_to_collection(movie_map) if len(builder.missing_movies) > 0 or len(builder.missing_shows) > 0: - builder.run_missing(movie_map, show_map) + builder.run_missing() if builder.sync and len(builder.rating_keys) > 0: builder.sync_collection() logger.info("") builder.update_details() - if builder.run_again and (len(builder.missing_movies) > 0 or len(builder.missing_shows) > 0): + if builder.run_again and (len(builder.run_again_movies) > 0 or len(builder.run_again_shows) > 0): library.run_again.append(builder) except Failed as e: