Log: Renamed log output and function names

Clear up confusion on what and where the movies are being removed from

ref:
- https://github.com/l3uddz/traktarr/issues/119
pull/132/head
desimaniac 5 years ago
parent e551aa1cb9
commit 267b02b28b

@ -35,7 +35,7 @@ def movies_to_tmdb_dict(radarr_movies):
return None return None
def remove_existing_movies(radarr_movies, trakt_movies, callback=None): def remove_existing_movies_from_trakt_list(radarr_movies, trakt_movies, callback=None):
new_movies_list = [] new_movies_list = []
try: try:
@ -49,7 +49,7 @@ def remove_existing_movies(radarr_movies, trakt_movies, callback=None):
# check if movie exists in processed_movies # check if movie exists in processed_movies
if tmp['movie']['ids']['tmdb'] in processed_movies: if tmp['movie']['ids']['tmdb'] in processed_movies:
movie_year = str(tmp['movie']['year']) if tmp['movie']['year'] else '????' movie_year = str(tmp['movie']['year']) if tmp['movie']['year'] else '????'
log.debug("Removing existing movie: \'%s (%s)\'", tmp['movie']['title'], movie_year) log.debug("Removing existing movie from Trakt list: \'%s (%s)\'", tmp['movie']['title'], movie_year)
if callback: if callback:
callback('movie', tmp) callback('movie', tmp)
continue continue
@ -81,7 +81,7 @@ def exclusions_to_tmdb_dict(radarr_exclusions):
return None return None
def remove_existing_exclusions(radarr_exclusions, trakt_movies, callback=None): def remove_excluded_movies_from_trakt_list(radarr_exclusions, trakt_movies, callback=None):
new_movies_list = [] new_movies_list = []
try: try:
@ -95,7 +95,7 @@ def remove_existing_exclusions(radarr_exclusions, trakt_movies, callback=None):
# check if movie exists in processed_movies # check if movie exists in processed_movies
if tmp['movie']['ids']['tmdb'] in processed_movies: if tmp['movie']['ids']['tmdb'] in processed_movies:
movie_year = str(tmp['movie']['year']) if tmp['movie']['year'] else '????' movie_year = str(tmp['movie']['year']) if tmp['movie']['year'] else '????'
log.debug("Removing excluded movie: \'%s (%s)\'", tmp['movie']['title'], movie_year) log.debug("Removing excluded movie from Trakt list: \'%s (%s)\'", tmp['movie']['title'], movie_year)
if callback: if callback:
callback('movie', tmp) callback('movie', tmp)
continue continue
@ -110,7 +110,7 @@ def remove_existing_exclusions(radarr_exclusions, trakt_movies, callback=None):
return None return None
def remove_existing_and_excluded_movies(radarr_movies, radarr_exclusions, trakt_movies, callback=None): def remove_existing_and_excluded_movies_from_trakt_list(radarr_movies, radarr_exclusions, trakt_movies, callback=None):
if not radarr_movies 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, False return None, False
@ -122,13 +122,15 @@ def remove_existing_and_excluded_movies(radarr_movies, radarr_exclusions, trakt_
return None, False return None, False
# filter out existing movies in radarr from new trakt list # filter out existing movies in radarr from new trakt list
processed_movies_list, removal_successful = remove_existing_movies(radarr_movies, trakt_movies, callback) processed_movies_list, removal_successful = remove_existing_movies_from_trakt_list(radarr_movies, trakt_movies,
callback)
if not processed_movies_list: if not processed_movies_list:
return None, removal_successful return None, removal_successful
# filter out radarr exclusions from the list above # filter out radarr exclusions from the list above
if radarr_exclusions: if radarr_exclusions:
processed_movies_list = remove_existing_exclusions(radarr_exclusions, processed_movies_list, callback) processed_movies_list = remove_excluded_movies_from_trakt_list(radarr_exclusions, processed_movies_list,
callback)
movies_removed_count = len(trakt_movies) - len(processed_movies_list) 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("Filtered a total of %d movies from the Trakt movies list.", movies_removed_count)

@ -64,7 +64,7 @@ def series_to_tvdb_dict(sonarr_series):
return None return None
def remove_existing_series(sonarr_series, trakt_series, callback=None): def remove_existing_series_from_trakt_list(sonarr_series, trakt_series, callback=None):
new_series_list = [] new_series_list = []
if not sonarr_series or not trakt_series: if not sonarr_series or not trakt_series:
@ -87,7 +87,7 @@ def remove_existing_series(sonarr_series, trakt_series, callback=None):
# check if show exists in processed_series # check if show exists in processed_series
if tmp['show']['ids']['tvdb'] in processed_series: if tmp['show']['ids']['tvdb'] in processed_series:
show_year = str(tmp['show']['year']) if tmp['show']['year'] else '????' show_year = str(tmp['show']['year']) if tmp['show']['year'] else '????'
log.debug("Removing existing show: \'%s (%s)\'", tmp['show']['title'], show_year) log.debug("Removing existing show from Trakt list: \'%s (%s)\'", tmp['show']['title'], show_year)
if callback: if callback:
callback('show', tmp) callback('show', tmp)
continue continue

@ -557,7 +557,7 @@ def shows(
remove_rejected_from_recommended = False remove_rejected_from_recommended = False
# build filtered series list without series that exist in sonarr # build filtered series list without series that exist in sonarr
processed_series_list = sonarr_helper.remove_existing_series( processed_series_list = sonarr_helper.remove_existing_series_from_trakt_list(
pvr_objects_list, pvr_objects_list,
trakt_objects_list, trakt_objects_list,
callback_remove_recommended if remove_rejected_from_recommended else None callback_remove_recommended if remove_rejected_from_recommended else None
@ -1066,7 +1066,7 @@ def movies(
remove_rejected_from_recommended = False remove_rejected_from_recommended = False
# build filtered movie list without movies that exist in radarr # build filtered movie list without movies that exist in radarr
processed_movies_list, removal_successful = radarr_helper.remove_existing_and_excluded_movies( processed_movies_list, removal_successful = radarr_helper.remove_existing_and_excluded_movies_from_trakt_list(
pvr_objects_list, pvr_objects_list,
pvr_exclusions_list, pvr_exclusions_list,
trakt_objects_list, trakt_objects_list,

Loading…
Cancel
Save