Empty list is not None

pull/164/head
Bochun Bai 3 years ago
parent 5b0427c21c
commit 5a8849e1b0
No known key found for this signature in database
GPG Key ID: 8433534ED5D633FD

@ -41,7 +41,7 @@ def remove_existing_movies_from_trakt_list(radarr_movies, trakt_movies, callback
try:
# turn radarr movies result into a dict with tmdb id as keys
processed_movies = movies_to_tmdb_dict(radarr_movies)
if not processed_movies:
if processed_movies is None:
return None
# loop list adding to movies that do not already exist

@ -67,19 +67,19 @@ def series_to_tvdb_dict(sonarr_series):
def remove_existing_series_from_trakt_list(sonarr_series, trakt_series, callback=None):
new_series_list = []
if not sonarr_series or not trakt_series:
if sonarr_series is None or trakt_series is None:
log.error("Inappropriate parameters were supplied.")
return None
try:
# clean up trakt_series list
trakt_series = filter_trakt_series_list(trakt_series, callback)
if not trakt_series:
if trakt_series is None:
return None
# turn sonarr series result into a dict with tvdb id as keys
processed_series = series_to_tvdb_dict(sonarr_series)
if not processed_series:
if processed_series is None:
return None
# loop list adding to series that do not already exist

@ -218,11 +218,8 @@ class Trakt:
log.error("Failed to retrieve %s %s, request response: %d", type_name, object_name, req.status_code)
break
if len(processed):
log.debug("Found %d %s %s", len(processed), type_name, object_name)
return processed
return None
log.debug("Found %d %s %s", len(processed), type_name, object_name)
return processed
except Exception:
log.exception("Exception retrieving %s %s: ", type_name, object_name)
return None

@ -547,7 +547,7 @@ def shows(
else:
trakt_objects_list = trakt.get_user_list_shows(list_type, authenticate_user)
if not trakt_objects_list:
if trakt_objects_list is None:
log.error("Aborting due to failure to retrieve Trakt \'%s\' shows list.", list_type.capitalize())
if notifications:
callback_notify(

Loading…
Cancel
Save