From dbe22b570b87d2c1408a7b0622b77786e55fbe5a Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 8 Jul 2014 23:07:26 -0700 Subject: [PATCH] NextEpisode code modified to return the airdate ordinal instead of a ep object, faster. --- gui/slick/interfaces/default/home.tmpl | 6 +++--- sickbeard/tv.py | 4 ++-- sickbeard/webapi.py | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/gui/slick/interfaces/default/home.tmpl b/gui/slick/interfaces/default/home.tmpl index 34e3f595..17120fdb 100644 --- a/gui/slick/interfaces/default/home.tmpl +++ b/gui/slick/interfaces/default/home.tmpl @@ -214,7 +214,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name)) #for $curShow in $myShowList: -#set $curEp = $curShow.nextEpisode() +#set $nextAirdate = $curShow.nextEpisode() #set $curShowDownloads = [x[1] for x in $downloadedEps if int(x[0]) == $curShow.indexerid] #set $curShowAll = [x[1] for x in $allEps if int(x[0]) == $curShow.indexerid] @@ -237,8 +237,8 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name)) #set $which_thumb = $layout+"_thumb" - #if $curEp: - #set $ldatetime = $network_timezones.parse_date_time($curEp.airdate.toordinal(),$curShow.airs,$curShow.network) + #if $nextAirdate: + #set $ldatetime = $network_timezones.parse_date_time($nextAirdate,$curShow.airs,$curShow.network)
$sbdatetime.sbdatetime.sbfdate($ldatetime)
$time.mktime($ldatetime.timetuple()) #else: diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 0ddefe58..d1c9ef6c 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -989,8 +989,8 @@ class TVShow(object): else: logger.log(str(self.indexerid) + u": Found episode " + str(sqlResults[0]["season"]) + "x" + str( sqlResults[0]["episode"]), logger.DEBUG) - curEp = self.getEpisode(int(sqlResults[0]["season"]), int(sqlResults[0]["episode"])) - return curEp + #curEp = self.getEpisode(int(sqlResults[0]["season"]), int(sqlResults[0]["episode"])) + return sqlResults[0]['airdate'] def deleteShow(self): diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index 28ad1e6a..35dd695e 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -1758,10 +1758,12 @@ class CMD_Show(ApiCall): showDict["network"] = "" showDict["status"] = showObj.status - nextAirdate = '' - nextEp = showObj.nextEpisode() - if nextEp: - nextAirdate = _ordinal_to_dateForm(nextEp.airdate.toordinal()) + nextAirdate = showObj.nextEpisode() + if nextAirdate: + nextAirdate = _ordinal_to_dateForm(nextAirdate) + else: + nextAirdate = '' + showDict["next_ep_airdate"] = nextAirdate return _responds(RESULT_SUCCESS, showDict) @@ -2500,10 +2502,11 @@ class CMD_Shows(ApiCall): """ display_is_int_multi( self.indexerid )shows in sickbeard """ shows = {} for curShow in sickbeard.showList: - nextAirdate = '' - nextEp = curShow.nextEpisode() - if nextEp: - nextAirdate = _ordinal_to_dateForm(nextEp.airdate.toordinal()) + nextAirdate = curShow.nextEpisode() + if nextAirdate: + nextAirdate = _ordinal_to_dateForm(nextAirdate) + else: + nextAirdate = '' if self.paused != None and bool(self.paused) != bool(curShow.paused): continue