Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty list is not None #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helpers/radarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions helpers/sonarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions media/trakt.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,8 @@ def _make_items_request(
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
Expand Down
2 changes: 1 addition & 1 deletion traktarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down