NextEpisode code modified to return the airdate ordinal instead of a ep object, faster.

This commit is contained in:
echel0n 2014-07-08 23:07:26 -07:00
parent 58788f52e5
commit dbe22b570b
3 changed files with 16 additions and 13 deletions

View file

@ -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"
<tr>
#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)
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;"><div class="${fuzzydate}">$sbdatetime.sbdatetime.sbfdate($ldatetime)</div><span class="sort_data">$time.mktime($ldatetime.timetuple())</span> </td>
#else:
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;"></td>

View file

@ -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):

View file

@ -1758,10 +1758,12 @@ class CMD_Show(ApiCall):
showDict["network"] = ""
showDict["status"] = showObj.status
nextAirdate = showObj.nextEpisode()
if nextAirdate:
nextAirdate = _ordinal_to_dateForm(nextAirdate)
else:
nextAirdate = ''
nextEp = showObj.nextEpisode()
if nextEp:
nextAirdate = _ordinal_to_dateForm(nextEp.airdate.toordinal())
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 = curShow.nextEpisode()
if nextAirdate:
nextAirdate = _ordinal_to_dateForm(nextAirdate)
else:
nextAirdate = ''
nextEp = curShow.nextEpisode()
if nextEp:
nextAirdate = _ordinal_to_dateForm(nextEp.airdate.toordinal())
if self.paused != None and bool(self.paused) != bool(curShow.paused):
continue