|
|
@ -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)
|
|
|
|