Fix e migliorie Autorenumber

This commit is contained in:
Alhaziel01
2020-11-09 15:44:22 +01:00
parent bc5b29dfdf
commit 87b960007a
4 changed files with 19 additions and 13 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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)

View File

@@ -19,10 +19,10 @@
<texture colordiffuse="CC232323">white.png</texture>
</control>
<control type="textbox">
<top>60</top>
<left>370</left>
<height>140</height>
<width>540</width>
<top>640</top>
<left>40</left>
<height>40</height>
<width>1200</width>
<align>center</align>
<aligny>center</aligny>
<textcolor>80FFFFFF</textcolor>