From 64bb3d53dc04cdc0bc76e9800a35fb422ba7504c Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 20 Nov 2014 21:25:44 +0000 Subject: [PATCH] Fix a handler when EpisodeData is not available in tvdb and tvrage APIs Addresses Traceback TypeError: list indices must be integers, not str. Is sometimes raised when doing a Force Full Update. --- CHANGES.md | 1 + lib/tvdb_api/tvdb_api.py | 4 +++- lib/tvrage_api/tvrage_api.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 6cd107d4..ca16e248 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -33,6 +33,7 @@ * Fix API endpoint Episode.SetStatus to "Wanted" * Change airdateModifyStamp to handle hour that is "00:00" * Fix a handler when ShowData is not available in tvdb and tvrage APIs +* Fix a handler when EpisodeData is not available in tvdb and tvrage APIs [develop changelog] diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 5dc4b794..9ade141b 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -871,8 +871,10 @@ class Tvdb: url = self.config['url_epInfo'] % (sid, language) epsEt = self._getetsrc(url, language=language) + if 'episode' not in epsEt: + return False - episodes = epsEt["episode"] + episodes = epsEt['episode'] if not isinstance(episodes, list): episodes = [episodes] diff --git a/lib/tvrage_api/tvrage_api.py b/lib/tvrage_api/tvrage_api.py index 1465f2ed..dd03b492 100644 --- a/lib/tvrage_api/tvrage_api.py +++ b/lib/tvrage_api/tvrage_api.py @@ -604,6 +604,8 @@ class TVRage: self.config['params_epInfo']['sid'] = sid epsEt = self._getetsrc(self.config['url_epInfo'], self.config['params_epInfo']) + if 'episode' not in epsEt: + return False seasons = epsEt['episodelist']['season'] if not isinstance(seasons, list):