Radarr: Ignore 0 movie exclusions

pull/105/head
desimaniac 5 years ago
parent 50057c65c7
commit 12010bd58b

@ -55,10 +55,10 @@ def remove_existing_movies(radarr_movies, trakt_movies, callback=None):
continue continue
new_movies_list.append(tmp) new_movies_list.append(tmp)
movies_removed = len(trakt_movies) - len(new_movies_list) 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) 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: except Exception:
log.exception("Exception removing existing movies from Trakt list: ") log.exception("Exception removing existing movies from Trakt list: ")
return None return None
@ -99,17 +99,17 @@ def remove_existing_exclusions(radarr_exclusions, trakt_movies, callback=None):
continue continue
new_movies_list.append(tmp) new_movies_list.append(tmp)
movies_removed = len(trakt_movies) - len(new_movies_list) 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) 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: except Exception:
log.exception("Exception removing excluded movies from Trakt list: ") log.exception("Exception removing excluded movies from Trakt list: ")
return None return None
def remove_existing_and_excluded_movies(radarr_movies, radarr_exclusions, trakt_movies, callback=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.") log.error("Inappropriate parameters were supplied.")
return None return None
@ -120,19 +120,19 @@ def remove_existing_and_excluded_movies(radarr_movies, radarr_exclusions, trakt_
return None return None
# filter out existing movies in radarr from new trakt list # filter out existing movies in radarr from new trakt list
preprocessed_movies_list, movies_removed_1 = remove_existing_movies(radarr_movies, trakt_movies, callback) processed_movies_list = remove_existing_movies(radarr_movies, trakt_movies, callback)
if not preprocessed_movies_list: if not processed_movies_list:
return None return None
# filter out radarr exclusions from the list above # filter out radarr exclusions from the list above
processed_movies_list, movies_removed_2 = remove_existing_exclusions(radarr_exclusions, if radarr_exclusions:
preprocessed_movies_list, processed_movies_list = remove_existing_exclusions(radarr_exclusions, processed_movies_list, callback)
callback)
if not processed_movies_list: if not processed_movies_list:
return None return None
movies_removed_total = movies_removed_1 + movies_removed_2 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_total) 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 return processed_movies_list
except Exception: except Exception:
log.exception("Exception removing existing and excluded movies from Trakt list: ") log.exception("Exception removing existing and excluded movies from Trakt list: ")

@ -97,6 +97,7 @@ def remove_existing_series(sonarr_series, trakt_series, callback=None):
series_removed = len(trakt_series) - len(new_series_list) 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("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 return new_series_list
except Exception: except Exception:
log.exception("Exception removing existing shows from Trakt list: ") log.exception("Exception removing existing shows from Trakt list: ")

@ -154,11 +154,7 @@ def get_exclusions(pvr, pvr_type, notifications):
objects_list = pvr.get_exclusions() objects_list = pvr.get_exclusions()
objects_type = 'movie' if pvr_type.lower() == 'radarr' else 'show' objects_type = 'movie' if pvr_type.lower() == 'radarr' else 'show'
if not objects_list: if not objects_list:
log.error("Aborting due to failure to retrieve %s exclusion list from %s", objects_type, pvr_type) log.info("No %s exclusions list found 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("Retrieved %s %s list, %s found: %d", pvr_type, objects_type, objects_type, len(objects_list)) log.info("Retrieved %s %s list, %s found: %d", pvr_type, objects_type, objects_type, len(objects_list))
return objects_list return objects_list

Loading…
Cancel
Save