From e8c06af550423849358bb7465405b18d29d696af Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Mon, 9 Nov 2020 19:46:53 +0100 Subject: [PATCH] Altri fix per TVDB e Autorenumber --- core/tvdb.py | 12 +++++++----- core/videolibrarytools.py | 5 +++-- platformcode/autorenumber.py | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/tvdb.py b/core/tvdb.py index bbf8e6f0..cad4c2e1 100644 --- a/core/tvdb.py +++ b/core/tvdb.py @@ -94,11 +94,13 @@ def find_and_set_infoLabels(item): title = title.replace(year, "").strip() item.infoLabels['year'] = year[1:-1] - if not item.infoLabels.get("tvdb_id"): - if not item.infoLabels.get("imdb_id"): + if item.infoLabels.get("tvdb_id") in ['', 'None']: + if item.infoLabels['year']: otvdb_global = Tvdb(search=title, year=item.infoLabels['year']) - else: + elif item.infoLabels.get("imdb_id"): otvdb_global = Tvdb(imdb_id=item.infoLabels.get("imdb_id")) + else: + otvdb_global = Tvdb(search=title) elif not otvdb_global or otvdb_global.get_id() != item.infoLabels['tvdb_id']: otvdb_global = Tvdb(tvdb_id=item.infoLabels['tvdb_id']) @@ -117,7 +119,7 @@ def find_and_set_infoLabels(item): if not tvdb_result: res = platformtools.dialog_info(item, 'tvdb') if not res.exit: return find_and_set_infoLabels(res) - elif len(results) > 0: + elif len(results) > 0 and results[0]['seriesId']: tvdb_result = results[0] else: @@ -818,7 +820,7 @@ class Tvdb(object): else: dict_html = req.json() - if "errors" in dict_html and "invalidLanguage" in dict_html["errors"]: + if "Error" in dict_html and "invalidLanguage" in dict_html["Error"]: return {} resultado1 = dict_html["data"] if not resultado1 and from_get_list: diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 5c0be50f..224509b9 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -1079,7 +1079,7 @@ def add_tvshow(item, channel=None): # Get the episode list # from core.support import dbg;dbg() itemlist = getattr(channel, item.action)(item) - if itemlist and not scrapertools.find_single_match(itemlist[0].title, r'[Ss]?(\d+)(?:x|_|\.|\s+)?[Ee]?[Pp]?(\d+)'): + if itemlist and not scrapertools.find_single_match(itemlist[0].title, r'[Ss]?(\d+)(?:x|_|\.|\s+)[Ee]?[Pp]?(\d+)'): from platformcode.autorenumber import start, check if not check(item): action = item.action @@ -1087,7 +1087,8 @@ def add_tvshow(item, channel=None): start(item) item.renumber = False item.action = action - return add_tvshow(item, channel) + if not item.exit: + return add_tvshow(item, channel) else: itemlist = getattr(channel, item.action)(item) diff --git a/platformcode/autorenumber.py b/platformcode/autorenumber.py index 0554c137..109c74bd 100644 --- a/platformcode/autorenumber.py +++ b/platformcode/autorenumber.py @@ -107,7 +107,8 @@ class autorenumber(): if self.item: self.auto = config.get_setting('autorenumber', item.channel) self.title = self.item.fulltitle.strip() - if match(self.itemlist[0].title, patron=r'(\d+\D\d+)').match: + if match(self.itemlist[0].title, patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)[Ee]?[Pp]?(\d+)').match: + item.exit = True return elif self.item.channel in self.item.channel_prefs and TVSHOW_RENUMERATE in self.item.channel_prefs[item.channel] and self.title not in self.dictSeries: from core.videolibrarytools import check_renumber_options