diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index a11e75ca..4603c198 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -601,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'[Ss]?(\d+)(?:x|_|\.|\s+)?[Ee]?[Pp]?(\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: @@ -1080,7 +1080,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 diff --git a/platformcode/autorenumber.py b/platformcode/autorenumber.py index cf5b2d27..66883346 100644 --- a/platformcode/autorenumber.py +++ b/platformcode/autorenumber.py @@ -4,7 +4,7 @@ # -------------------------------------------------------------------------------- -import xbmcgui, re, base64, inspect, sys +import xbmc, xbmcgui, re, base64, inspect, sys from core import jsontools, tvdb, scrapertools, filetools from core.item import Item from core.support import typo, match, dbg, Item @@ -84,7 +84,9 @@ def find_episodes(item): itemlist = ch.episodios(item) return itemlist - +def busy(state): + if state: xbmc.executebuiltin('ActivateWindow(busydialognocancel)') + else: xbmc.executebuiltin('Dialog.Close(busydialognocancel)') # Main def start(itemlist, item=None): @@ -94,8 +96,11 @@ def start(itemlist, item=None): item.channel = item.from_channel item.action = item.from_action item.renumber = True + busy(True) itemlist = find_episodes(item) + busy(False) return autorenumber(itemlist, item) + class autorenumber(): def __init__(self, itemlist, item=None): self.item = item @@ -107,7 +112,7 @@ 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'[Ss]?(\d+)(?:x|_|\.|\s+)[Ee]?[Pp]?(\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: @@ -174,7 +179,7 @@ class autorenumber(): season = int(self.Season) addNumber = 0 for item in self.itemlist: - if not match(item.title, patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)[Ee]?[Pp]?(\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: @@ -204,7 +209,9 @@ class autorenumber(): season = int(self.Season) ep = 1 + busy(True) itemlist = find_episodes(self.item) + busy(False) if self.item.renumber: self.s = season @@ -274,7 +281,7 @@ class autorenumber(): addiction = 0 for item in itemlist: - if not match(re.sub(r'\[[^\]]+\]','',item.title), patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)[Ee]?[Pp]?(\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: @@ -423,7 +430,7 @@ class SelectreNumerationWindow(xbmcgui.WindowXMLDialog): # MAIN / SPECIALS else: for item in self.itemlist: - if not match(item.title, patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)[Ee]?[Pp]?(\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)