|
|
|
@ -35,7 +35,7 @@ def movies_to_tmdb_dict(radarr_movies):
|
|
|
|
|
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 = []
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
@ -49,7 +49,7 @@ def remove_existing_movies(radarr_movies, trakt_movies, callback=None):
|
|
|
|
|
# check if movie exists in processed_movies
|
|
|
|
|
if tmp['movie']['ids']['tmdb'] in processed_movies:
|
|
|
|
|
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:
|
|
|
|
|
callback('movie', tmp)
|
|
|
|
|
continue
|
|
|
|
@ -81,7 +81,7 @@ def exclusions_to_tmdb_dict(radarr_exclusions):
|
|
|
|
|
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 = []
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
@ -95,7 +95,7 @@ def remove_existing_exclusions(radarr_exclusions, trakt_movies, callback=None):
|
|
|
|
|
# check if movie exists in processed_movies
|
|
|
|
|
if tmp['movie']['ids']['tmdb'] in processed_movies:
|
|
|
|
|
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:
|
|
|
|
|
callback('movie', tmp)
|
|
|
|
|
continue
|
|
|
|
@ -110,7 +110,7 @@ def remove_existing_exclusions(radarr_exclusions, trakt_movies, callback=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:
|
|
|
|
|
log.error("Inappropriate parameters were supplied.")
|
|
|
|
|
return None, False
|
|
|
|
@ -122,13 +122,15 @@ def remove_existing_and_excluded_movies(radarr_movies, radarr_exclusions, trakt_
|
|
|
|
|
return None, False
|
|
|
|
|
|
|
|
|
|
# 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:
|
|
|
|
|
return None, removal_successful
|
|
|
|
|
|
|
|
|
|
# filter out radarr exclusions from the list above
|
|
|
|
|
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)
|
|
|
|
|
log.debug("Filtered a total of %d movies from the Trakt movies list.", movies_removed_count)
|
|
|
|
|