1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Instead of checking for NULL when trying to update trakt.tv library or watchlists we now check length

This commit is contained in:
echel0n 2014-11-20 04:47:36 -08:00
parent ce8989a115
commit 8320672669

View File

@ -53,14 +53,14 @@ class TraktChecker():
def findShow(self, indexer, indexerid): 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) 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: if not library:
logger.log(u"Could not connect to trakt service, aborting library check", logger.ERROR) logger.log(u"Could not connect to trakt service, aborting library check", logger.ERROR)
return 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) return filter(lambda x: int(indexerid) in [int(x['tvdb_id']) or 0, int(x['tvrage_id'])] or 0, library)
def syncLibrary(self): def syncLibrary(self):
@ -106,14 +106,14 @@ class TraktChecker():
logger.log(u"Starting trakt show watchlist check", logger.DEBUG) 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) 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: if not watchlist:
logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.ERROR) logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.ERROR)
return return
if not len(watchlist):
logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG)
return
for show in watchlist: for show in watchlist:
indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER) indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
if indexer == 2: if indexer == 2:
@ -140,14 +140,14 @@ class TraktChecker():
logger.log(u"Starting trakt episode watchlist check", logger.DEBUG) 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) 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: if not watchlist:
logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.ERROR) logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.ERROR)
return return
if not len(watchlist):
logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG)
return
for show in watchlist: for show in watchlist:
indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER) indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
if indexer == 2: if indexer == 2: