Bug found and fixed in indexerAPI module.

This commit is contained in:
echel0n 2014-03-15 19:58:15 -07:00
parent fac97e5f5a
commit 31ccc8ffe2
3 changed files with 7 additions and 12 deletions

View file

@ -530,7 +530,7 @@ class Tvdb:
else: else:
sess = requests.Session() sess = requests.Session()
# get response from TVRage # get response from TVDB
resp = sess.get(url, params=params) resp = sess.get(url, params=params)
except Exception, e: except Exception, e:
if not str(e).startswith('HTTP Error'): if not str(e).startswith('HTTP Error'):

View file

@ -22,27 +22,22 @@ import sickbeard
class GenericIndexer(object): class GenericIndexer(object):
def __init__(self, indexer): def __init__(self, indexer):
INDEXER_NONE = None
INDEXER_TVDB = 'Tvdb' INDEXER_TVDB = 'Tvdb'
INDEXER_TVRAGE = 'TVRage' INDEXER_TVRAGE = 'TVRage'
INDEXERS = {} INDEXERS = {}
INDEXERS[INDEXER_NONE] = ''
INDEXERS[INDEXER_TVDB] = 'theTVDB' INDEXERS[INDEXER_TVDB] = 'theTVDB'
INDEXERS[INDEXER_TVRAGE] = 'TVRage' INDEXERS[INDEXER_TVRAGE] = 'TVRage'
INDEXER_API_KEY = {} INDEXER_API_KEY = {}
INDEXER_API_KEY[INDEXER_NONE] = ''
INDEXER_API_KEY[INDEXER_TVDB] = '9DAF49C96CBF8DAC' INDEXER_API_KEY[INDEXER_TVDB] = '9DAF49C96CBF8DAC'
INDEXER_API_KEY[INDEXER_TVRAGE] = 'Uhewg1Rr0o62fvZvUIZt' INDEXER_API_KEY[INDEXER_TVRAGE] = 'Uhewg1Rr0o62fvZvUIZt'
INDEXER_BASEURL = {} INDEXER_BASEURL = {}
INDEXER_BASEURL[INDEXER_NONE] = ''
INDEXER_BASEURL[INDEXER_TVDB] = 'http://thetvdb.com/api/' + INDEXER_API_KEY[INDEXER_TVDB] + '/series/' 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_BASEURL[INDEXER_TVRAGE] = 'http://tvrage.com/showinfo?key=' + INDEXER_API_KEY[INDEXER_TVRAGE] + 'sid='
INDEXER_API_PARMS = {} INDEXER_API_PARMS = {}
INDEXER_API_PARMS[INDEXER_NONE] = ''
INDEXER_API_PARMS[INDEXER_TVDB] = {'apikey': INDEXER_API_KEY[INDEXER_TVDB], INDEXER_API_PARMS[INDEXER_TVDB] = {'apikey': INDEXER_API_KEY[INDEXER_TVDB],
'language': 'en', 'language': 'en',
'useZip': True} 'useZip': True}
@ -60,12 +55,12 @@ class GenericIndexer(object):
'tr': 21, 'pl': 18, 'fr': 17, 'hr': 31, 'de': 14, 'da': 10, 'fi': 11, '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} '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.base_url = INDEXER_BASEURL[indexer]
self.api_parms = INDEXER_API_PARMS[indexer] self.api_parms = INDEXER_API_PARMS[indexer]
self.name = INDEXERS[indexer] self.name = INDEXERS[indexer]
if sickbeard.CACHE_DIR: if sickbeard.CACHE_DIR:
self.cache = os.path.join(sickbeard.CACHE_DIR, indexer) self.cache = os.path.join(sickbeard.CACHE_DIR, indexer)

View file

@ -27,9 +27,9 @@ from lib.tvrage_api.tvrage_api import TVRage
class indexerApi(generic.GenericIndexer): class indexerApi(generic.GenericIndexer):
def __init__(self, indexer=None, *args, **kwargs): 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) self.api_parms.update(**kwargs)
if sickbeard.CACHE_DIR: if sickbeard.CACHE_DIR: