mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 03:48:02 -05:00
Fixed issues with randomly returned empty show statuses, added tvrage status mapping to ensure it never gets returned incorrectly.
This commit is contained in:
parent
1ff906f3ff
commit
9000dbd10a
@ -601,7 +601,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<img src="$sbRoot/images/#if int($curShow.paused) == 0 and $curShow.status != "Ended" then "yes16.png\" alt=\"Y\"" else "no16.png\" alt=\"N\""# width="16" height="16" />
|
<img src="$sbRoot/images/#if int($curShow.paused) == 0 and $curShow.status == "Continuing" then "yes16.png\" alt=\"Y\"" else "no16.png\" alt=\"N\""# width="16" height="16" />
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#set $sql_result = $myDB.select($sql_statement)
|
#set $sql_result = $myDB.select($sql_statement)
|
||||||
|
|
||||||
#set $shows_total = len($sickbeard.showList)
|
#set $shows_total = len($sickbeard.showList)
|
||||||
#set $shows_active = len([show for show in $sickbeard.showList if show.paused == 0 and show.status != "Ended"])
|
#set $shows_active = len([show for show in $sickbeard.showList if show.paused == 0 and show.status == "Continuing"])
|
||||||
|
|
||||||
#if $sql_result:
|
#if $sql_result:
|
||||||
#set $ep_snatched = $sql_result[0]['ep_snatched']
|
#set $ep_snatched = $sql_result[0]['ep_snatched']
|
||||||
|
@ -439,6 +439,22 @@ class TVRage:
|
|||||||
'seasonnum': 'episodenumber'
|
'seasonnum': 'episodenumber'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status_map = {
|
||||||
|
'returning series': 'Continuing',
|
||||||
|
'canceled/ended': 'Ended',
|
||||||
|
'tbd/on the bubble': 'Continuing',
|
||||||
|
'in development': 'Continuing',
|
||||||
|
'new series': 'Continuing',
|
||||||
|
'never aired': 'Ended',
|
||||||
|
'final season': 'Continuing',
|
||||||
|
'on hiatus': 'Continuing',
|
||||||
|
'pilot ordered': 'Continuing',
|
||||||
|
'pilot rejected': 'Ended',
|
||||||
|
'canceled': 'Ended',
|
||||||
|
'ended': 'Ended',
|
||||||
|
'': 'Unknown',
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
key = name_map[key.lower()]
|
key = name_map[key.lower()]
|
||||||
except (ValueError, TypeError, KeyError):
|
except (ValueError, TypeError, KeyError):
|
||||||
@ -447,8 +463,17 @@ class TVRage:
|
|||||||
# clean up value and do type changes
|
# clean up value and do type changes
|
||||||
if value:
|
if value:
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
|
if key == 'status':
|
||||||
|
try:
|
||||||
|
value = status_map[str(value).lower()]
|
||||||
|
if not value:
|
||||||
|
raise
|
||||||
|
except:
|
||||||
|
value = 'Unknown'
|
||||||
|
|
||||||
if key == 'network':
|
if key == 'network':
|
||||||
value = value['#text']
|
value = value['#text']
|
||||||
|
|
||||||
if key == 'genre':
|
if key == 'genre':
|
||||||
value = value['genre']
|
value = value['genre']
|
||||||
if not value:
|
if not value:
|
||||||
@ -457,6 +482,7 @@ class TVRage:
|
|||||||
value = [value]
|
value = [value]
|
||||||
value = filter(None, value)
|
value = filter(None, value)
|
||||||
value = '|' + '|'.join(value) + '|'
|
value = '|' + '|'.join(value) + '|'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if key == 'firstaired' and value in "0000-00-00":
|
if key == 'firstaired' and value in "0000-00-00":
|
||||||
new_value = str(dt.date.fromordinal(1))
|
new_value = str(dt.date.fromordinal(1))
|
||||||
|
@ -82,7 +82,7 @@ class TVShow(object):
|
|||||||
self._imdb_info = {}
|
self._imdb_info = {}
|
||||||
self._quality = int(sickbeard.QUALITY_DEFAULT)
|
self._quality = int(sickbeard.QUALITY_DEFAULT)
|
||||||
self._flatten_folders = int(sickbeard.FLATTEN_FOLDERS_DEFAULT)
|
self._flatten_folders = int(sickbeard.FLATTEN_FOLDERS_DEFAULT)
|
||||||
self._status = ""
|
self._status = "Unknown"
|
||||||
self._airs = ""
|
self._airs = ""
|
||||||
self._startyear = 0
|
self._startyear = 0
|
||||||
self._paused = 0
|
self._paused = 0
|
||||||
@ -282,7 +282,7 @@ class TVShow(object):
|
|||||||
def should_update(self, update_date=datetime.date.today()):
|
def should_update(self, update_date=datetime.date.today()):
|
||||||
|
|
||||||
# if show is not 'Ended' always update (status 'Continuing')
|
# if show is not 'Ended' always update (status 'Continuing')
|
||||||
if not self.status or 'Ended' not in self.status:
|
if 'Unknown' not in self.status and 'Ended' not in self.status:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# run logic against the current show latest aired and next unaired data to see if we should bypass 'Ended' status
|
# run logic against the current show latest aired and next unaired data to see if we should bypass 'Ended' status
|
||||||
@ -776,7 +776,7 @@ class TVShow(object):
|
|||||||
|
|
||||||
self.status = sqlResults[0]["status"]
|
self.status = sqlResults[0]["status"]
|
||||||
if self.status is None:
|
if self.status is None:
|
||||||
self.status = ""
|
self.status = "Unknown"
|
||||||
|
|
||||||
self.airs = sqlResults[0]["airs"]
|
self.airs = sqlResults[0]["airs"]
|
||||||
if self.airs is None:
|
if self.airs is None:
|
||||||
@ -873,7 +873,7 @@ class TVShow(object):
|
|||||||
if getattr(myEp, 'firstaired', None) is not None:
|
if getattr(myEp, 'firstaired', None) is not None:
|
||||||
self.startyear = int(str(myEp["firstaired"]).split('-')[0])
|
self.startyear = int(str(myEp["firstaired"]).split('-')[0])
|
||||||
|
|
||||||
self.status = getattr(myEp, 'status', '')
|
self.status = getattr(myEp, 'status', 'Unknown')
|
||||||
|
|
||||||
def loadIMDbInfo(self, imdbapi=None):
|
def loadIMDbInfo(self, imdbapi=None):
|
||||||
|
|
||||||
@ -1174,8 +1174,7 @@ class TVShow(object):
|
|||||||
toReturn += "network: " + self.network + "\n"
|
toReturn += "network: " + self.network + "\n"
|
||||||
if self.airs:
|
if self.airs:
|
||||||
toReturn += "airs: " + self.airs + "\n"
|
toReturn += "airs: " + self.airs + "\n"
|
||||||
if self.status:
|
toReturn += "status: " + self.status + "\n"
|
||||||
toReturn += "status: " + self.status + "\n"
|
|
||||||
toReturn += "startyear: " + str(self.startyear) + "\n"
|
toReturn += "startyear: " + str(self.startyear) + "\n"
|
||||||
if self.genre:
|
if self.genre:
|
||||||
toReturn += "genre: " + self.genre + "\n"
|
toReturn += "genre: " + self.genre + "\n"
|
||||||
|
@ -2793,7 +2793,7 @@ class CMD_ShowsStats(ApiCall):
|
|||||||
today = str(datetime.date.today().toordinal())
|
today = str(datetime.date.today().toordinal())
|
||||||
stats["shows_total"] = len(sickbeard.showList)
|
stats["shows_total"] = len(sickbeard.showList)
|
||||||
stats["shows_active"] = len(
|
stats["shows_active"] = len(
|
||||||
[show for show in sickbeard.showList if show.paused == 0 and show.status != "Ended"])
|
[show for show in sickbeard.showList if show.paused == 0 and "Unknown" not in show.status and "Ended" not in show.status])
|
||||||
stats["ep_downloaded"] = myDB.select("SELECT COUNT(*) FROM tv_episodes WHERE status IN (" + ",".join(
|
stats["ep_downloaded"] = myDB.select("SELECT COUNT(*) FROM tv_episodes WHERE status IN (" + ",".join(
|
||||||
[str(show) for show in
|
[str(show) for show in
|
||||||
Quality.DOWNLOADED + [ARCHIVED]]) + ") AND season != 0 and episode != 0 AND airdate <= " + today + "")[0][
|
Quality.DOWNLOADED + [ARCHIVED]]) + ") AND season != 0 and episode != 0 AND airdate <= " + today + "")[0][
|
||||||
|
Loading…
Reference in New Issue
Block a user