From 87b960007a581969e4b8da1acb9a0a97d342ffa7 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Mon, 9 Nov 2020 15:44:22 +0100 Subject: [PATCH] Fix e migliorie Autorenumber --- core/tvdb.py | 2 +- core/videolibrarytools.py | 14 ++++++++++---- platformcode/autorenumber.py | 8 ++++---- resources/skins/Default/720p/Renumber.xml | 8 ++++---- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/core/tvdb.py b/core/tvdb.py index b24164ca..bbf8e6f0 100644 --- a/core/tvdb.py +++ b/core/tvdb.py @@ -167,7 +167,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 and item.contentType == 'episode': + if 'infoLabels' in item and 'season' in item.infoLabels and item.contentType != 'tvshow': try: int_season = int(item.infoLabels['season']) except ValueError: diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 0e195c51..5c0be50f 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -436,7 +436,10 @@ def save_tvshow(item, episodelist, silent=False): return 0, 0, -1, path # Salimos sin guardar contentTypeBackup = item.contentType # Fix errors in some channels - scraper_return = scraper.find_and_set_infoLabels(item) + if not item.infoLabels['code']: + scraper_return = scraper.find_and_set_infoLabels(item) + else: + scraper_return = True item.contentType = contentTypeBackup # Fix errors in some channels # At this point we can have: # scraper_return = True: An item with infoLabels with the updated information of the series @@ -598,7 +601,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): local_episodelist += get_local_content(local_episodes_path) clean_list = [] for f in filetools.listdir(path): - match = scrapertools.find_single_match(f, r'[S]?(\d+)(?:x|_|\.)?[E]?(\d+)') + match = scrapertools.find_single_match(f, r'[Ss]?(\d+)(?:x|_|\.|\s+)?[Ee]?[Pp]?(\d+)') if match: ep = '%dx%02d' % (int(match[0]), int(match[1])) if ep in local_episodelist: @@ -778,7 +781,10 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): item_nfo = None if not nfo_exists and e.infoLabels["code"]: # If there is no season_episode.nfo add it - scraper.find_and_set_infoLabels(e) + if serie.infoLabels["code"]: + e.infoLabels["code"] = serie.infoLabels["code"] + else: + scraper.find_and_set_infoLabels(e) head_nfo = scraper.get_nfo(e) item_nfo = e.clone(channel="videolibrary", url="", action='findvideos', strm_path=strm_path.replace(TVSHOWS_PATH, "")) @@ -1073,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'(\d+x\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 diff --git a/platformcode/autorenumber.py b/platformcode/autorenumber.py index 99877926..3fe9551a 100644 --- a/platformcode/autorenumber.py +++ b/platformcode/autorenumber.py @@ -173,7 +173,7 @@ class autorenumber(): addNumber = 0 for item in self.itemlist: - if not match(item.title, patron=r'(\d+)x(\d+)').match: + if not match(item.title, patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)?[Ee]?[Pp]?(\d+)').match: number = match(item.title, patron=r'(\d+)').match.lstrip('0') if number: if number in self.Episodes: @@ -223,11 +223,11 @@ class autorenumber(): self.Episodes = Seasons else: - # Ricava Informazioni da TVDB checkpages = [] exist = True Page = self.Pages[-1] + Episode = ep while exist: data = tvdb.Tvdb(tvdb_id=self.id).get_list_episodes(self.id, Page) @@ -272,7 +272,7 @@ class autorenumber(): # specialsCount = 1 # pdialog.update(80, 'rinumerazione') for item in itemlist: - if not match(re.sub(r'\[[^\]]+\]','',item.title), patron=r'(\d+)x(\d+)').match: + if not match(re.sub(r'\[[^\]]+\]','',item.title), patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)?[Ee]?[Pp]?(\d+)').match: # Otiene Numerazione Episodi scraped_ep = match(re.sub(r'\[[^\]]+\]','',item.title), patron=r'(\d+)').match if scraped_ep: @@ -424,7 +424,7 @@ class SelectreNumerationWindow(xbmcgui.WindowXMLDialog): self.getControl(MANUAL).setVisible(False) for item in self.itemlist: - if not match(item.title, patron=r'(\d+)x(\d+)').match: + if not match(item.title, patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)?[Ee]?[Pp]?(\d+)').match: title = match(item.title, patron=r'(\d+)').match.lstrip('0') it = xbmcgui.ListItem(title) self.items.append(it) diff --git a/resources/skins/Default/720p/Renumber.xml b/resources/skins/Default/720p/Renumber.xml index 6571b407..9badbdb9 100644 --- a/resources/skins/Default/720p/Renumber.xml +++ b/resources/skins/Default/720p/Renumber.xml @@ -19,10 +19,10 @@ white.png - 60 - 370 - 140 - 540 + 640 + 40 + 40 + 1200 center center 80FFFFFF