mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Improved and faster nextepisode function, speeds up home page load times.
This commit is contained in:
parent
fe65ecd2c3
commit
a085f0f538
2 changed files with 6 additions and 12 deletions
|
@ -237,8 +237,8 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
|||
#set $which_thumb = $layout+"_thumb"
|
||||
|
||||
<tr>
|
||||
#if len($curEp) != 0:
|
||||
#set $ldatetime = $network_timezones.parse_date_time($curEp[0].airdate.toordinal(),$curShow.airs,$curShow.network)
|
||||
#if $curEp:
|
||||
#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>
|
||||
#else:
|
||||
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;"></td>
|
||||
|
|
|
@ -979,11 +979,8 @@ class TVShow(object):
|
|||
logger.log(str(self.indexerid) + ": Finding the episode which airs next", logger.DEBUG)
|
||||
|
||||
myDB = db.DBConnection()
|
||||
innerQuery = "SELECT airdate 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]
|
||||
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)
|
||||
sqlResults = myDB.select("SELECT airdate, season, episode FROM tv_episodes WHERE showid = ? AND airdate >= ? AND status in (?,?) ORDER BY airdate ASC LIMIT 1",
|
||||
[self.indexerid, datetime.date.today().toordinal(), UNAIRED, WANTED])
|
||||
|
||||
if sqlResults == None or len(sqlResults) == 0:
|
||||
logger.log(str(self.indexerid) + u": No episode found... need to implement a show status",
|
||||
|
@ -992,11 +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)
|
||||
foundEps = []
|
||||
for sqlEp in sqlResults:
|
||||
curEp = self.getEpisode(int(sqlEp["season"]), int(sqlEp["episode"]))
|
||||
foundEps.append(curEp)
|
||||
return foundEps
|
||||
curEp = self.getEpisode(int(sqlResults[0]["season"]), int(sqlResults[0]["episode"]))
|
||||
return curEp
|
||||
|
||||
def deleteShow(self):
|
||||
|
||||
|
|
Loading…
Reference in a new issue