1
0
mirror of https://github.com/moparisthebest/SickRage synced 2025-01-05 19:08:02 -05: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: for sqlShow in sqlResults:
try: try:
curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"])) curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
curShow.nextEpisode()
sickbeard.showList.append(curShow) sickbeard.showList.append(curShow)
except Exception, e: except Exception, e:
logger.log( logger.log(

View File

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

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

View File

@ -93,6 +93,9 @@ class ShowUpdater():
for curShow in sickbeard.showList: for curShow in sickbeard.showList:
try: 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 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: if curShow.should_update(update_date=update_date) or curShow.indexerid in stale_should_update:
curQueueItem = sickbeard.showQueueScheduler.action.updateShow(curShow, True) # @UndefinedVariable curQueueItem = sickbeard.showQueueScheduler.action.updateShow(curShow, True) # @UndefinedVariable

View File

@ -988,7 +988,7 @@ class TVShow(object):
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",
logger.DEBUG) logger.DEBUG)
self.nextaired = curDate self.nextaired = None
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)

View File

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