mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Updated nextepisode function to only perform db calls when nextaired date has been reached.
This commit is contained in:
parent
dbe22b570b
commit
5237e70fb3
1 changed files with 16 additions and 12 deletions
|
@ -96,6 +96,7 @@ class TVShow(object):
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
self.isDirGood = False
|
self.isDirGood = False
|
||||||
self.episodes = {}
|
self.episodes = {}
|
||||||
|
self.nextaired = None
|
||||||
|
|
||||||
otherShow = helpers.findCertainShow(sickbeard.showList, self.indexerid)
|
otherShow = helpers.findCertainShow(sickbeard.showList, self.indexerid)
|
||||||
if otherShow != None:
|
if otherShow != None:
|
||||||
|
@ -978,6 +979,8 @@ class TVShow(object):
|
||||||
def nextEpisode(self):
|
def nextEpisode(self):
|
||||||
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)
|
||||||
|
|
||||||
|
curDate = datetime.date.today().toordinal()
|
||||||
|
if not self.nextaired or self.nextaired and curDate > self.nextaired:
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
sqlResults = myDB.select("SELECT airdate, season, episode 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",
|
||||||
[self.indexerid, datetime.date.today().toordinal(), UNAIRED, WANTED])
|
[self.indexerid, datetime.date.today().toordinal(), UNAIRED, WANTED])
|
||||||
|
@ -989,8 +992,9 @@ 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)
|
||||||
#curEp = self.getEpisode(int(sqlResults[0]["season"]), int(sqlResults[0]["episode"]))
|
self.nextaired = sqlResults[0]['airdate']
|
||||||
return sqlResults[0]['airdate']
|
|
||||||
|
return self.nextaired
|
||||||
|
|
||||||
def deleteShow(self):
|
def deleteShow(self):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue