From 12010bd58b21fb32d088b8a9233719274735f5cd Mon Sep 17 00:00:00 2001 From: desimaniac <5501908+desimaniac@users.noreply.github.com> Date: Sun, 6 Oct 2019 15:38:12 -0500 Subject: [PATCH] Radarr: Ignore 0 movie exclusions --- helpers/radarr.py | 34 +++++++++++++++++----------------- helpers/sonarr.py | 1 + traktarr.py | 6 +----- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/helpers/radarr.py b/helpers/radarr.py index afd88ae..3fbc535 100644 --- a/helpers/radarr.py +++ b/helpers/radarr.py @@ -55,10 +55,10 @@ def remove_existing_movies(radarr_movies, trakt_movies, callback=None): continue new_movies_list.append(tmp) - movies_removed = len(trakt_movies) - len(new_movies_list) - log.debug("Filtered %d movies from Trakt list that were already in Radarr.", movies_removed) + movies_removed_count = len(trakt_movies) - len(new_movies_list) + log.debug("Filtered %d movies from Trakt list that were already in Radarr.", movies_removed_count) - return new_movies_list, movies_removed + return new_movies_list except Exception: log.exception("Exception removing existing movies from Trakt list: ") return None @@ -99,17 +99,17 @@ def remove_existing_exclusions(radarr_exclusions, trakt_movies, callback=None): continue new_movies_list.append(tmp) - movies_removed = len(trakt_movies) - len(new_movies_list) - log.debug("Filtered %d movies from Trakt list that were excluded in Radarr.", movies_removed) + movies_removed_count = len(trakt_movies) - len(new_movies_list) + log.debug("Filtered %d movies from Trakt list that were excluded in Radarr.", movies_removed_count) - return new_movies_list, movies_removed + return new_movies_list except Exception: log.exception("Exception removing excluded movies from Trakt list: ") return None def remove_existing_and_excluded_movies(radarr_movies, radarr_exclusions, trakt_movies, callback=None): - if not radarr_movies or not radarr_exclusions or not trakt_movies: + if not radarr_movies or not trakt_movies: log.error("Inappropriate parameters were supplied.") return None @@ -120,19 +120,19 @@ def remove_existing_and_excluded_movies(radarr_movies, radarr_exclusions, trakt_ return None # filter out existing movies in radarr from new trakt list - preprocessed_movies_list, movies_removed_1 = remove_existing_movies(radarr_movies, trakt_movies, callback) - if not preprocessed_movies_list: - return None - - # filter out radarr exclusions from the list above - processed_movies_list, movies_removed_2 = remove_existing_exclusions(radarr_exclusions, - preprocessed_movies_list, - callback) + processed_movies_list = remove_existing_movies(radarr_movies, trakt_movies, callback) if not processed_movies_list: return None - movies_removed_total = movies_removed_1 + movies_removed_2 - log.debug("Filtered a total of %d movies from the Trakt movies list.", movies_removed_total) + # filter out radarr exclusions from the list above + if radarr_exclusions: + processed_movies_list = remove_existing_exclusions(radarr_exclusions, processed_movies_list, callback) + if not processed_movies_list: + return None + + movies_removed_count = len(trakt_movies) - len(processed_movies_list) + log.debug("Filtered a total of %d movies from the Trakt movies list.", movies_removed_count) + log.debug("New Trakt movies list count: %d", len(processed_movies_list)) return processed_movies_list except Exception: log.exception("Exception removing existing and excluded movies from Trakt list: ") diff --git a/helpers/sonarr.py b/helpers/sonarr.py index 19568e7..bfe56c8 100644 --- a/helpers/sonarr.py +++ b/helpers/sonarr.py @@ -97,6 +97,7 @@ def remove_existing_series(sonarr_series, trakt_series, callback=None): series_removed = len(trakt_series) - len(new_series_list) log.debug("Filtered %d shows from Trakt list that were already in Sonarr.", series_removed) + log.debug("New Trakt shows list count: %d", len(new_series_list)) return new_series_list except Exception: log.exception("Exception removing existing shows from Trakt list: ") diff --git a/traktarr.py b/traktarr.py index fc9f1df..0536e7c 100755 --- a/traktarr.py +++ b/traktarr.py @@ -154,11 +154,7 @@ def get_exclusions(pvr, pvr_type, notifications): objects_list = pvr.get_exclusions() objects_type = 'movie' if pvr_type.lower() == 'radarr' else 'show' if not objects_list: - log.error("Aborting due to failure to retrieve %s exclusion list from %s", objects_type, pvr_type) - if notifications: - callback_notify({'event': 'error', 'reason': 'Failure to retrieve %s exclusions list from %s' % - (objects_type, pvr_type)}) - exit() + log.info("No %s exclusions list found from %s", objects_type, pvr_type) log.info("Retrieved %s %s list, %s found: %d", pvr_type, objects_type, objects_type, len(objects_list)) return objects_list