From 83206726699b4a3cf94687fb73b5eede3abf4886 Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 20 Nov 2014 04:47:36 -0800 Subject: [PATCH] Instead of checking for NULL when trying to update trakt.tv library or watchlists we now check length --- sickbeard/traktChecker.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sickbeard/traktChecker.py b/sickbeard/traktChecker.py index 320d1413..332028d7 100644 --- a/sickbeard/traktChecker.py +++ b/sickbeard/traktChecker.py @@ -53,14 +53,14 @@ class TraktChecker(): def findShow(self, indexer, indexerid): library = TraktCall("user/library/shows/all.json/%API%/" + sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD) - if library == 'NULL': - logger.log(u"No shows found in your library, aborting library update", logger.DEBUG) - return - if not library: logger.log(u"Could not connect to trakt service, aborting library check", logger.ERROR) return + if not len(library): + logger.log(u"No shows found in your library, aborting library update", logger.DEBUG) + return + return filter(lambda x: int(indexerid) in [int(x['tvdb_id']) or 0, int(x['tvrage_id'])] or 0, library) def syncLibrary(self): @@ -106,14 +106,14 @@ class TraktChecker(): logger.log(u"Starting trakt show watchlist check", logger.DEBUG) watchlist = TraktCall("user/watchlist/shows.json/%API%/" + sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD) - if watchlist == 'NULL': - logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG) - return - if not watchlist: logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.ERROR) return + if not len(watchlist): + logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG) + return + for show in watchlist: indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER) if indexer == 2: @@ -140,14 +140,14 @@ class TraktChecker(): logger.log(u"Starting trakt episode watchlist check", logger.DEBUG) watchlist = TraktCall("user/watchlist/episodes.json/%API%/" + sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD) - if watchlist == 'NULL': - logger.log(u"No episodes found in your watchlist, aborting watchlist update", logger.DEBUG) - return - if not watchlist: logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.ERROR) return + if not len(watchlist): + logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG) + return + for show in watchlist: indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER) if indexer == 2: