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

Improved and faster nextepisode function, speeds up home page load times.

This commit is contained in:
echel0n 2014-07-08 22:42:56 -07:00
parent fe65ecd2c3
commit a085f0f538
2 changed files with 6 additions and 12 deletions

View File

@ -237,8 +237,8 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
#set $which_thumb = $layout+"_thumb" #set $which_thumb = $layout+"_thumb"
<tr> <tr>
#if len($curEp) != 0: #if $curEp:
#set $ldatetime = $network_timezones.parse_date_time($curEp[0].airdate.toordinal(),$curShow.airs,$curShow.network) #set $ldatetime = $network_timezones.parse_date_time($curEp.airdate.toordinal(),$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> <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: #else:
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;"></td> <td align="center" class="nowrap" style="color: #555555;font-weight:bold;"></td>

View File

@ -979,11 +979,8 @@ class TVShow(object):
logger.log(str(self.indexerid) + ": Finding the episode which airs next", logger.DEBUG) logger.log(str(self.indexerid) + ": Finding the episode which airs next", logger.DEBUG)
myDB = db.DBConnection() myDB = db.DBConnection()
innerQuery = "SELECT airdate FROM tv_episodes WHERE showid = ? AND airdate >= ? AND status in (?,?) ORDER BY airdate ASC LIMIT 1" sqlResults = myDB.select("SELECT airdate, season, episode FROM tv_episodes WHERE showid = ? AND airdate >= ? AND status in (?,?) ORDER BY airdate ASC LIMIT 1",
innerParams = [self.indexerid, datetime.date.today().toordinal(), UNAIRED, WANTED] [self.indexerid, datetime.date.today().toordinal(), UNAIRED, WANTED])
query = "SELECT * FROM tv_episodes WHERE showid = ? AND airdate >= ? AND airdate <= (" + innerQuery + ") and status in (?,?)"
params = [self.indexerid, datetime.date.today().toordinal()] + innerParams + [UNAIRED, WANTED]
sqlResults = myDB.select(query, params)
if sqlResults == None or len(sqlResults) == 0: if sqlResults == None or len(sqlResults) == 0:
logger.log(str(self.indexerid) + u": No episode found... need to implement a show status", logger.log(str(self.indexerid) + u": No episode found... need to implement a show status",
@ -992,11 +989,8 @@ class TVShow(object):
else: else:
logger.log(str(self.indexerid) + u": Found episode " + str(sqlResults[0]["season"]) + "x" + str( logger.log(str(self.indexerid) + u": Found episode " + str(sqlResults[0]["season"]) + "x" + str(
sqlResults[0]["episode"]), logger.DEBUG) sqlResults[0]["episode"]), logger.DEBUG)
foundEps = [] curEp = self.getEpisode(int(sqlResults[0]["season"]), int(sqlResults[0]["episode"]))
for sqlEp in sqlResults: return curEp
curEp = self.getEpisode(int(sqlEp["season"]), int(sqlEp["episode"]))
foundEps.append(curEp)
return foundEps
def deleteShow(self): def deleteShow(self):