diff --git a/gui/slick/interfaces/default/home.tmpl b/gui/slick/interfaces/default/home.tmpl index c4244626..12cf6a95 100644 --- a/gui/slick/interfaces/default/home.tmpl +++ b/gui/slick/interfaces/default/home.tmpl @@ -601,7 +601,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name)) - \"Y\"" + \"Y\"" diff --git a/gui/slick/interfaces/default/inc_bottom.tmpl b/gui/slick/interfaces/default/inc_bottom.tmpl index f6621060..5c9dfd57 100644 --- a/gui/slick/interfaces/default/inc_bottom.tmpl +++ b/gui/slick/interfaces/default/inc_bottom.tmpl @@ -27,7 +27,7 @@ #set $sql_result = $myDB.select($sql_statement) #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: #set $ep_snatched = $sql_result[0]['ep_snatched'] diff --git a/lib/tvrage_api/tvrage_api.py b/lib/tvrage_api/tvrage_api.py index 832b82ae..2c0993c4 100644 --- a/lib/tvrage_api/tvrage_api.py +++ b/lib/tvrage_api/tvrage_api.py @@ -439,6 +439,22 @@ class TVRage: '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: key = name_map[key.lower()] except (ValueError, TypeError, KeyError): @@ -447,8 +463,17 @@ class TVRage: # clean up value and do type changes if value: if isinstance(value, dict): + if key == 'status': + try: + value = status_map[str(value).lower()] + if not value: + raise + except: + value = 'Unknown' + if key == 'network': value = value['#text'] + if key == 'genre': value = value['genre'] if not value: @@ -457,6 +482,7 @@ class TVRage: value = [value] value = filter(None, value) value = '|' + '|'.join(value) + '|' + try: if key == 'firstaired' and value in "0000-00-00": new_value = str(dt.date.fromordinal(1)) diff --git a/sickbeard/tv.py b/sickbeard/tv.py index fa388e14..0efde9bb 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -82,7 +82,7 @@ class TVShow(object): self._imdb_info = {} self._quality = int(sickbeard.QUALITY_DEFAULT) self._flatten_folders = int(sickbeard.FLATTEN_FOLDERS_DEFAULT) - self._status = "" + self._status = "Unknown" self._airs = "" self._startyear = 0 self._paused = 0 @@ -282,7 +282,7 @@ class TVShow(object): def should_update(self, update_date=datetime.date.today()): # 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 # 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"] if self.status is None: - self.status = "" + self.status = "Unknown" self.airs = sqlResults[0]["airs"] if self.airs is None: @@ -873,7 +873,7 @@ class TVShow(object): if getattr(myEp, 'firstaired', None) is not None: self.startyear = int(str(myEp["firstaired"]).split('-')[0]) - self.status = getattr(myEp, 'status', '') + self.status = getattr(myEp, 'status', 'Unknown') def loadIMDbInfo(self, imdbapi=None): @@ -1174,8 +1174,7 @@ class TVShow(object): toReturn += "network: " + self.network + "\n" if self.airs: toReturn += "airs: " + self.airs + "\n" - if self.status: - toReturn += "status: " + self.status + "\n" + toReturn += "status: " + self.status + "\n" toReturn += "startyear: " + str(self.startyear) + "\n" if self.genre: toReturn += "genre: " + self.genre + "\n" diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index 387a2aec..ad616534 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -2793,7 +2793,7 @@ class CMD_ShowsStats(ApiCall): today = str(datetime.date.today().toordinal()) stats["shows_total"] = len(sickbeard.showList) 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( [str(show) for show in Quality.DOWNLOADED + [ARCHIVED]]) + ") AND season != 0 and episode != 0 AND airdate <= " + today + "")[0][