Fic TVDB e Autorenumber in casi limite

This commit is contained in:
Alhaziel01
2020-11-07 16:41:38 +01:00
parent 84452a962b
commit 549ca38125
2 changed files with 40 additions and 36 deletions
+5 -2
View File
@@ -163,7 +163,7 @@ def set_infoLabels_item(item):
if 'infoLabels' in item and 'fanart' in item.infoLabels['fanart']:
item.fanart = item.infoLabels['fanart']
if 'infoLabels' in item and 'season' in item.infoLabels:
if 'infoLabels' in item and 'season' in item.infoLabels and item.contentType == 'episode':
try:
int_season = int(item.infoLabels['season'])
except ValueError:
@@ -659,10 +659,12 @@ class Tvdb(object):
url = HOST + "/episodes/%s" % _id
# from core.support import dbg;dbg()
try:
DEFAULT_HEADERS["Accept-Language"] = lang
logger.debug("url: %s, \nheaders: %s" % (url, DEFAULT_HEADERS))
dict_html = requests.get(url, headers=DEFAULT_HEADERS).json
req = requests.get(url, headers=DEFAULT_HEADERS)
except Exception as ex:
# if isinstance(ex, urllib).HTTPError:
@@ -671,6 +673,7 @@ class Tvdb(object):
logger.error("error en: %s" % message)
else:
dict_html = req.json()
# logger.info("dict_html %s" % dict_html)
self.episodes[_id] = dict_html.pop("data") if 'Error' not in dict_html else {}