mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixes for TVDB and TVRage API search issues.
This commit is contained in:
parent
1f180a5a05
commit
97a1693abf
@ -602,7 +602,11 @@ class Tvdb:
|
||||
except zipfile.BadZipfile:
|
||||
raise tvdb_error("Bad zip file received from thetvdb.com, could not read it")
|
||||
else:
|
||||
return xmltodict.parse(resp.content.strip().encode('utf-8'), postprocessor=process)
|
||||
try:
|
||||
return xmltodict.parse(resp.content.strip().encode('utf-8'), postprocessor=process)
|
||||
except:
|
||||
return xmltodict.parse(resp.content.strip(), postprocessor=process)
|
||||
|
||||
|
||||
def _getetsrc(self, url, params=None, language=None):
|
||||
"""Loads a URL using caching, returns an ElementTree of the source
|
||||
@ -855,7 +859,11 @@ class Tvdb:
|
||||
|
||||
epsEt = self._getetsrc(url, language=language)
|
||||
|
||||
for cur_ep in epsEt["episode"]:
|
||||
episodes = epsEt["episode"]
|
||||
if not isinstance(episodes, list):
|
||||
episodes = [episodes]
|
||||
|
||||
for cur_ep in episodes:
|
||||
if self.config['dvdorder']:
|
||||
log().debug('Using DVD ordering.')
|
||||
use_dvd = cur_ep['dvd_season'] != None and cur_ep['dvd_episodenumber'] != None
|
||||
|
@ -390,7 +390,7 @@ class TVRage:
|
||||
|
||||
return os.path.join(tempfile.gettempdir(), "tvrage_api-%s" % (uid))
|
||||
|
||||
@retry(tvrage_error)
|
||||
#@retry(tvrage_error)
|
||||
def _loadUrl(self, url, params=None):
|
||||
try:
|
||||
log().debug("Retrieving URL %s" % url)
|
||||
@ -462,7 +462,10 @@ class TVRage:
|
||||
return (key, value)
|
||||
|
||||
if resp.ok:
|
||||
return xmltodict.parse(resp.content.strip().encode('utf-8'), postprocessor=remap_keys)
|
||||
try:
|
||||
return xmltodict.parse(resp.content.strip().encode('utf-8'), postprocessor=remap_keys)
|
||||
except:
|
||||
return xmltodict.parse(resp.content.strip(), postprocessor=remap_keys)
|
||||
|
||||
def _getetsrc(self, url, params=None):
|
||||
"""Loads a URL using caching, returns an ElementTree of the source
|
||||
@ -598,13 +601,17 @@ class TVRage:
|
||||
self.config['params_epInfo']['sid'] = sid
|
||||
epsEt = self._getetsrc(self.config['url_epInfo'], self.config['params_epInfo'])
|
||||
|
||||
for season in epsEt['episodelist'].values():
|
||||
episodes = season['episode']
|
||||
seasons = epsEt['episodelist']['season']
|
||||
if not isinstance(seasons, list):
|
||||
seasons = [seasons]
|
||||
|
||||
for season in seasons:
|
||||
seas_no = int(season['@no'])
|
||||
episodes = season['episode']
|
||||
if not isinstance(episodes, list):
|
||||
episodes = [episodes]
|
||||
|
||||
for episode in episodes:
|
||||
seas_no = int(season['@no'])
|
||||
ep_no = int(episode['episodenumber'])
|
||||
self._setItem(sid, seas_no, ep_no, 'seasonnumber', seas_no)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user