From 58d5452dc3a153e92066a6317fc29e650230c778 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 19 Mar 2015 15:34:11 +0000 Subject: [PATCH] Change to gracefully handle some "key not found" failures when TVDB or TVRage return "Not Found" during show updates. --- CHANGES.md | 1 + lib/tvdb_api/tvdb_api.py | 2 +- lib/tvrage_api/tvrage_api.py | 2 +- sickbeard/show_queue.py | 4 +++- sickbeard/tv.py | 3 +++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2260c12b..bfb1b546 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -66,6 +66,7 @@ * Remove restriction to not display snatched eps link in footer on Episode Overview page * Change the shows episodes count text colour to visually separete from year numbers at the end of show names * Fix release group not recognised from manually downloaded filename +* Change to gracefully handle some "key not found" failures when TVDB or TVRage return "Not Found" during show updates [develop changelog] * Fix traceback error when using the menu item Manage/Update Kodi diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 49cd6666..60b92db7 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -938,7 +938,7 @@ class Tvdb: # Item is integer, treat as show id if key not in self.shows: self._getShowData(key, self.config['language'], True) - return (None, self.shows[key])[key in self.shows] + return None if key not in self.shows else self.shows[key] key = str(key).lower() self.config['searchterm'] = key diff --git a/lib/tvrage_api/tvrage_api.py b/lib/tvrage_api/tvrage_api.py index b5347bdf..730295e9 100644 --- a/lib/tvrage_api/tvrage_api.py +++ b/lib/tvrage_api/tvrage_api.py @@ -660,7 +660,7 @@ class TVRage: # Item is integer, treat as show id if key not in self.shows: self._getShowData(key, True) - return (None, self.shows[key])[key in self.shows] + return None if key not in self.shows else self.shows[key] key = key.lower() self.config['searchterm'] = key diff --git a/sickbeard/show_queue.py b/sickbeard/show_queue.py index fc415d9c..6dccecad 100644 --- a/sickbeard/show_queue.py +++ b/sickbeard/show_queue.py @@ -550,7 +550,9 @@ class QueueItemUpdate(ShowQueueItem): logger.log(u"Retrieving show info from " + sickbeard.indexerApi(self.show.indexer).name + "", logger.DEBUG) try: - self.show.loadFromIndexer(cache=not self.force) + result = self.show.loadFromIndexer(cache=not self.force) + if None is not result: + return except sickbeard.indexer_error, e: logger.log(u"Unable to contact " + sickbeard.indexerApi(self.show.indexer).name + ", aborting: " + ex(e), logger.WARNING) diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 70513b74..ae9239d9 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -871,6 +871,9 @@ class TVShow(object): t = tvapi myEp = t[self.indexerid] + if None is myEp: + logger.log(u'Show not found (maybe even removed?)', logger.WARNING) + return False try: self.name = myEp['seriesname'].strip()