From 58788f52e5bcfd0fdc7258cad40081981eb8c2a5 Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 8 Jul 2014 22:53:51 -0700 Subject: [PATCH] Corrected API to work with new nextepisode function code changes. --- sickbeard/tv.py | 2 +- sickbeard/webapi.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sickbeard/tv.py b/sickbeard/tv.py index c1e15378..0ddefe58 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -985,7 +985,7 @@ class TVShow(object): if sqlResults == None or len(sqlResults) == 0: logger.log(str(self.indexerid) + u": No episode found... need to implement a show status", logger.DEBUG) - return [] + return None else: logger.log(str(self.indexerid) + u": Found episode " + str(sqlResults[0]["season"]) + "x" + str( sqlResults[0]["episode"]), logger.DEBUG) diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index 7ded782f..28ad1e6a 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -1759,9 +1759,9 @@ class CMD_Show(ApiCall): showDict["status"] = showObj.status nextAirdate = '' - nextEps = showObj.nextEpisode() - if (len(nextEps) != 0): - nextAirdate = _ordinal_to_dateForm(nextEps[0].airdate.toordinal()) + nextEp = showObj.nextEpisode() + if nextEp: + nextAirdate = _ordinal_to_dateForm(nextEp.airdate.toordinal()) showDict["next_ep_airdate"] = nextAirdate return _responds(RESULT_SUCCESS, showDict) @@ -2501,9 +2501,9 @@ class CMD_Shows(ApiCall): shows = {} for curShow in sickbeard.showList: nextAirdate = '' - nextEps = curShow.nextEpisode() - if (len(nextEps) != 0): - nextAirdate = _ordinal_to_dateForm(nextEps[0].airdate.toordinal()) + nextEp = curShow.nextEpisode() + if nextEp: + nextAirdate = _ordinal_to_dateForm(nextEp.airdate.toordinal()) if self.paused != None and bool(self.paused) != bool(curShow.paused): continue