From 31ccc8ffe2a8a024587a7ec1e28f9a5621347d1b Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 15 Mar 2014 19:58:15 -0700 Subject: [PATCH] Bug found and fixed in indexerAPI module. --- lib/tvdb_api/tvdb_api.py | 2 +- sickbeard/indexers/generic.py | 13 ++++--------- sickbeard/indexers/indexer_api.py | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index e0ddc141..b4dd7588 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -530,7 +530,7 @@ class Tvdb: else: sess = requests.Session() - # get response from TVRage + # get response from TVDB resp = sess.get(url, params=params) except Exception, e: if not str(e).startswith('HTTP Error'): diff --git a/sickbeard/indexers/generic.py b/sickbeard/indexers/generic.py index ecb5c0ff..90896e87 100644 --- a/sickbeard/indexers/generic.py +++ b/sickbeard/indexers/generic.py @@ -22,27 +22,22 @@ import sickbeard class GenericIndexer(object): def __init__(self, indexer): - INDEXER_NONE = None INDEXER_TVDB = 'Tvdb' INDEXER_TVRAGE = 'TVRage' INDEXERS = {} - INDEXERS[INDEXER_NONE] = '' INDEXERS[INDEXER_TVDB] = 'theTVDB' INDEXERS[INDEXER_TVRAGE] = 'TVRage' INDEXER_API_KEY = {} - INDEXER_API_KEY[INDEXER_NONE] = '' INDEXER_API_KEY[INDEXER_TVDB] = '9DAF49C96CBF8DAC' INDEXER_API_KEY[INDEXER_TVRAGE] = 'Uhewg1Rr0o62fvZvUIZt' INDEXER_BASEURL = {} - INDEXER_BASEURL[INDEXER_NONE] = '' INDEXER_BASEURL[INDEXER_TVDB] = 'http://thetvdb.com/api/' + INDEXER_API_KEY[INDEXER_TVDB] + '/series/' INDEXER_BASEURL[INDEXER_TVRAGE] = 'http://tvrage.com/showinfo?key=' + INDEXER_API_KEY[INDEXER_TVRAGE] + 'sid=' INDEXER_API_PARMS = {} - INDEXER_API_PARMS[INDEXER_NONE] = '' INDEXER_API_PARMS[INDEXER_TVDB] = {'apikey': INDEXER_API_KEY[INDEXER_TVDB], 'language': 'en', 'useZip': True} @@ -60,12 +55,12 @@ class GenericIndexer(object): 'tr': 21, 'pl': 18, 'fr': 17, 'hr': 31, 'de': 14, 'da': 10, 'fi': 11, 'hu': 19, 'ja': 25, 'he': 24, 'ko': 32, 'sv': 8, 'sl': 30} - self.indexers = [indexer for indexer in INDEXERS] + self.indexers = [x for x in INDEXERS] - if indexer: + if indexer in INDEXERS: self.base_url = INDEXER_BASEURL[indexer] self.api_parms = INDEXER_API_PARMS[indexer] self.name = INDEXERS[indexer] - if sickbeard.CACHE_DIR: - self.cache = os.path.join(sickbeard.CACHE_DIR, indexer) \ No newline at end of file + if sickbeard.CACHE_DIR: + self.cache = os.path.join(sickbeard.CACHE_DIR, indexer) \ No newline at end of file diff --git a/sickbeard/indexers/indexer_api.py b/sickbeard/indexers/indexer_api.py index b34ddcf7..0ed17055 100644 --- a/sickbeard/indexers/indexer_api.py +++ b/sickbeard/indexers/indexer_api.py @@ -27,9 +27,9 @@ from lib.tvrage_api.tvrage_api import TVRage class indexerApi(generic.GenericIndexer): def __init__(self, indexer=None, *args, **kwargs): - super(indexerApi, self).__init__(indexer) + generic.GenericIndexer.__init__(self, indexer) - if indexer: + if indexer in self.indexers: self.api_parms.update(**kwargs) if sickbeard.CACHE_DIR: