1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Updated next episode airdate function to be run once at startup and then each time after that with show update schedualer

This commit is contained in:
echel0n 2014-07-09 00:49:05 -07:00
parent 23239e0a5d
commit d6225dd8d3
6 changed files with 10 additions and 7 deletions

View File

@ -414,6 +414,7 @@ class SickRage(object):
for sqlShow in sqlResults:
try:
curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
curShow.nextEpisode()
sickbeard.showList.append(curShow)
except Exception, e:
logger.log(

View File

@ -214,7 +214,6 @@
$myShowList.sort(lambda x, y: cmp(x.name, y.name))
#for $curShow in $myShowList:
#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 +236,8 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
#set $which_thumb = $layout+"_thumb"
<tr>
#if $nextAirdate:
#set $ldatetime = $network_timezones.parse_date_time($nextAirdate,$curShow.airs,$curShow.network)
#if $curShow.nextaired:
#set $ldatetime = $network_timezones.parse_date_time($curShow.nextaired,$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

@ -111,7 +111,7 @@
#set $myShowList = $sickbeard.showList
$myShowList.sort(lambda x, y: cmp(x.name, y.name))
#for $curShow in $myShowList:
#set $curEp = $curShow.nextEpisode()
#set $curEp = $curShow.nextaired
#set $curUpdate_disabled = ""
#set $curRefresh_disabled = ""
#set $curRename_disabled = ""

View File

@ -93,6 +93,9 @@ class ShowUpdater():
for curShow in sickbeard.showList:
try:
# get next episode airdate
curShow.nextEpisode()
# if should_update returns True (not 'Ended') or show is selected stale 'Ended' then update, otherwise just refresh
if curShow.should_update(update_date=update_date) or curShow.indexerid in stale_should_update:
curQueueItem = sickbeard.showQueueScheduler.action.updateShow(curShow, True) # @UndefinedVariable

View File

@ -988,7 +988,7 @@ class TVShow(object):
if sqlResults == None or len(sqlResults) == 0:
logger.log(str(self.indexerid) + u": No episode found... need to implement a show status",
logger.DEBUG)
self.nextaired = curDate
self.nextaired = None
else:
logger.log(str(self.indexerid) + u": Found episode " + str(sqlResults[0]["season"]) + "x" + str(
sqlResults[0]["episode"]), logger.DEBUG)

View File

@ -1758,7 +1758,7 @@ class CMD_Show(ApiCall):
showDict["network"] = ""
showDict["status"] = showObj.status
nextAirdate = showObj.nextEpisode()
nextAirdate = showObj.nextaired
if nextAirdate:
nextAirdate = _ordinal_to_dateForm(nextAirdate)
else:
@ -2502,7 +2502,7 @@ class CMD_Shows(ApiCall):
""" display_is_int_multi( self.indexerid )shows in sickbeard """
shows = {}
for curShow in sickbeard.showList:
nextAirdate = curShow.nextEpisode()
nextAirdate = curShow.nextaired
if nextAirdate:
nextAirdate = _ordinal_to_dateForm(nextAirdate)
else: