From 84452a962b9c3c063b85a8ade6fe147e08f4612a Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 7 Nov 2020 15:03:50 +0100 Subject: [PATCH 1/5] Fix Autorenumber --- platformcode/autorenumber.py | 1 - resources/skins/Default/720p/InfoWindow.xml | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/platformcode/autorenumber.py b/platformcode/autorenumber.py index df2d6ca9..644aeccc 100644 --- a/platformcode/autorenumber.py +++ b/platformcode/autorenumber.py @@ -143,7 +143,6 @@ class autorenumber(): self.item.contentSerieName = self.title.rstrip('123456789 ') while not self.item.exit: - self.item = platformtools.dialog_info(self.item, 'tvdb') # <- Enter title to search tvdb.find_and_set_infoLabels(self.item) if self.item.infoLabels['tvdb_id']: self.item.exit = True diff --git a/resources/skins/Default/720p/InfoWindow.xml b/resources/skins/Default/720p/InfoWindow.xml index 39caf843..33d03572 100644 --- a/resources/skins/Default/720p/InfoWindow.xml +++ b/resources/skins/Default/720p/InfoWindow.xml @@ -20,6 +20,13 @@ + + 1280 + 720 + white.png + + + 1280 720 From 549ca38125edb382dd176125082e2388f62016da Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 7 Nov 2020 16:41:38 +0100 Subject: [PATCH 2/5] Fic TVDB e Autorenumber in casi limite --- core/tvdb.py | 7 ++-- platformcode/autorenumber.py | 69 ++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/core/tvdb.py b/core/tvdb.py index 79f28d4b..784532c8 100644 --- a/core/tvdb.py +++ b/core/tvdb.py @@ -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 {} diff --git a/platformcode/autorenumber.py b/platformcode/autorenumber.py index 644aeccc..0d6ddf38 100644 --- a/platformcode/autorenumber.py +++ b/platformcode/autorenumber.py @@ -109,7 +109,7 @@ class autorenumber(): from specials.videolibrary import update_videolibrary check_renumber_options(self.item) update_videolibrary(self.item) - if self.title in self.dictSeries: + if self.title in self.dictSeries and ID in self.dictSeries[self.title] and self.dictSeries[self.title][ID] != '0': self.id = self.dictSeries[self.title][ID] self.Episodes = b64(self.dictSeries[self.title][EPISODE], 'decode') self.Season = self.dictSeries[self.title][SEASON] @@ -161,7 +161,7 @@ class autorenumber(): self.renumber() def renumber(self): - if not self.item.renumber and self.itemlist and len(self.Episodes) >= len(self.itemlist) and match(self.itemlist[0].title, patron=r'(\d+)').match in self.Episodes: + if not self.item.renumber and self.itemlist and match(self.itemlist[0].title, patron=r'(\d+)').match.lstrip('0') in self.Episodes: if '|' in self.Season: season = int(self.Season.split('|')[0]) addNumber = int(self.Season.split('|')[-1]) - 1 @@ -170,16 +170,16 @@ class autorenumber(): addNumber = 0 for item in self.itemlist: - number = match(item.title, patron=r'(\d+)').match - number = number.lstrip('0') - if number: - if number in self.Episodes: - if season > 0: item.title = typo(self.Episodes[number] + ' - ', 'bold') + item.title - else: item.title = typo('0x%s - ' % str(int(number) + addNumber), 'bold') + item.title - else: - self.makelist() - if season > 0: item.title = typo(self.Episodes[number] + ' - ', 'bold') + item.title - else: item.title = typo('0x%s - ' % str(int(number) + addNumber), 'bold') + item.title + if not match(item.title, patron=r'(\d+)x(\d+)').match: + number = match(item.title, patron=r'(\d+)').match.lstrip('0') + if number: + if number in self.Episodes: + if season > 0: item.title = typo(self.Episodes[number] + ' - ', 'bold') + item.title + else: item.title = typo('0x%s - ' % str(int(number) + addNumber), 'bold') + item.title + else: + self.makelist() + if season > 0: item.title = typo(self.Episodes[number] + ' - ', 'bold') + item.title + else: item.title = typo('0x%s - ' % str(int(number) + addNumber), 'bold') + item.title else: self.makelist() @@ -269,24 +269,25 @@ class autorenumber(): # specialsCount = 1 # pdialog.update(80, 'rinumerazione') for item in itemlist: - # Otiene Numerazione Episodi - scraped_ep = match(re.sub(r'\[[^\]]+\]','',item.title), patron=r'(\d+)').match - if scraped_ep: - episode = int(scraped_ep) - number = episode + FirstOfSeason - addiction - if episode == 0: - self.Episodes[str(episode)] = str(self.complete[self.regular[FirstOfSeason+1][2]][0]) - elif episode in Specials: - self.Episodes[str(episode)] = Specials[episode] - addiction += 1 - elif number <= len(self.regular) and number in self.regular: - self.Episodes[str(episode)] = str(self.regular[number][0]) - else: - try: Episodes[str(episode)] = str(self.complete[self.regular[number+2][2]][0]) - except: self.Episodes[str(episode)] = '0x0' + if not match(re.sub(r'\[[^\]]+\]','',item.title), patron=r'(\d+)x(\d+)').match: + # Otiene Numerazione Episodi + scraped_ep = match(re.sub(r'\[[^\]]+\]','',item.title), patron=r'(\d+)').match + if scraped_ep: + episode = int(scraped_ep) + number = episode + FirstOfSeason - addiction + if episode == 0: + self.Episodes[str(episode)] = str(self.complete[self.regular[FirstOfSeason+1][2]][0]) + elif episode in Specials: + self.Episodes[str(episode)] = Specials[episode] + addiction += 1 + elif number <= len(self.regular) and number in self.regular: + self.Episodes[str(episode)] = str(self.regular[number][0]) + else: + try: Episodes[str(episode)] = str(self.complete[self.regular[number+2][2]][0]) + except: self.Episodes[str(episode)] = '0x0' - self.dictSeries[self.title][EPISODE] = b64(jsontools.dump(self.Episodes)) + if self.Episodes: self.dictSeries[self.title][EPISODE] = b64(jsontools.dump(self.Episodes)) self.dictSeries[self.title][EPLIST] = b64(jsontools.dump(self.EpList)) self.dictSeries[self.title][MODE] = self.Mode self.dictSeries[self.title][SEASON] = self.Season @@ -396,7 +397,7 @@ class SelectreNumerationWindow(xbmcgui.WindowXMLDialog): ep = '1' position = 0 for i, item in enumerate(self.itemlist): - title = match(item.title, patron=r'(\d+)').match + title = match(item.title, patron=r'(\d+)').match.lstrip('0') it = xbmcgui.ListItem(title) if int(title) <= len(self.episodes): se, ep = self.episodes[title].split('x') @@ -419,11 +420,11 @@ class SelectreNumerationWindow(xbmcgui.WindowXMLDialog): self.getControl(SPECIALS).setVisible(False) self.getControl(MANUAL).setVisible(False) - for i, item in enumerate(self.itemlist): - title = match(item.title, patron=r'(\d+)').match - it = xbmcgui.ListItem(title) - it.setProperty('index', str(i)) - self.items.append(it) + for item in self.itemlist: + if not match(item.title, patron=r'(\d+)x(\d+)').match: + title = match(item.title, patron=r'(\d+)').match.lstrip('0') + it = xbmcgui.ListItem(title) + self.items.append(it) self.getControl(POSTER).setImage(thumb) self.getControl(MPOSTER).setImage(thumb) From da471c5f6e35e0938996b9848e2e0b956e735585 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 7 Nov 2020 17:15:03 +0100 Subject: [PATCH 3/5] Fix Streaming Community --- channels/streamingcommunity.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index e68cddfc..9d526f17 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -175,10 +175,9 @@ def episodios(item): def findvideos(item): + support.info() itemlist=[] url = support.match(support.match(item).data.replace('"','"').replace('\\',''), patron=r'video_url"\s*:\s*"([^"]+)"').match - playlist = support.match(url.replace('https','http'), patron=r'\./([^.]+)').matches - for res in playlist: - itemlist.append(item.clone(title=support.config.get_localized_string(30137), server='directo', url=url.replace('playlist',res), quality=res, action='play')) + itemlist=[item.clone(title=support.config.get_localized_string(30137), server='directo', url=url, action='play')] return support.server(item, itemlist=itemlist) \ No newline at end of file From d90062f6d3e4632c677892d81ab2ffb77050742b Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 7 Nov 2020 18:10:59 +0100 Subject: [PATCH 4/5] Fix Installazione Elementum --- platformcode/elementum_download.py | 10 ++++++++-- platformcode/launcher.py | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/platformcode/elementum_download.py b/platformcode/elementum_download.py index 53c1ed8a..588543fc 100644 --- a/platformcode/elementum_download.py +++ b/platformcode/elementum_download.py @@ -18,6 +18,9 @@ def download(item=None): if filetools.exists(elementum_path): if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70783)): + addon_file = filetools.file_open(filetools.join(elementum_path,'addon.xml')).read() + required = support.match(addon_file, patron=r'addon="([^"]+)').matches + for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True) setting() platformtools.dialog_ok('Elementum', config.get_localized_string(70783)) @@ -32,6 +35,9 @@ def download(item=None): downloadtools.downloadfile(host + url, filename) extract() xbmc.sleep(1000) + addon_file = filetools.file_open(filetools.join(elementum_path,'addon.xml')).read() + required = support.match(addon_file, patron=r'addon="([^"]+)').matches + for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True) setting() @@ -40,8 +46,8 @@ def extract(): from platformcode.updater import fixZipGetHash support.info('Estraggo Elementum in:', elementum_path) try: - hash = fixZipGetHash(filename) - support.info(hash) + # hash = fixZipGetHash(filename) + # support.info(hash) with zipfile.ZipFile(filetools.file_open(filename, 'rb', vfs=False)) as zip_ref: zip_ref.extractall(xbmc.translatePath(addon_path)) diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 7e279c37..d16ddf26 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -129,6 +129,10 @@ def run(item=None): from platformcode import backup return getattr(backup, item.action)(item) + elif item.channel == "elementum_download": + from platformcode import elementum_download + return getattr(elementum_download, item.action)(item) + elif item.channel == "shortcuts": from platformcode import shortcuts return getattr(shortcuts, item.action)(item) From 19240c6ab434f6b19eb7c9092d765c5aba20b2c3 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 7 Nov 2020 18:48:15 +0100 Subject: [PATCH 5/5] Fix streamZ --- servers/streamz.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/servers/streamz.py b/servers/streamz.py index 8701e8f8..5540558d 100644 --- a/servers/streamz.py +++ b/servers/streamz.py @@ -19,15 +19,17 @@ def test_video_exists(page_url): def get_video_url(page_url, video_password): logger.info("(page_url='%s')" % page_url) video_urls = [] + from core.support import match + matches = match(data, patron=r'(eval\(function\(p,a,c,k,e,d\).*?)\s+').matches + unpacked = '' + for packed in matches: + unpacked += jsunpack.unpack(packed) + '\n' - packed = scrapertools.find_single_match(data, r'(eval\(function\(p,a,c,k,e,d\).*?)\s+') - unpacked = jsunpack.unpack(packed) + urls = match(unpacked, patron=r"videojs\d+[^;]+[^']+'[^']+'[^']+'(https://streamz.*?/get.*?.dll)").matches - url = scrapertools.find_single_match(unpacked, '(https://streamz.*?/get.*?.dll)') - - url = url.replace("getmp4", "getlink").replace("getIink", "getlink") - - url += "|User-Agent=%s" % httptools.get_user_agent() - video_urls.append(["[streamZ]", url]) + for url in urls: + url = url + "|User-Agent=%s" % httptools.get_user_agent() + if not video_urls or url not in video_urls[-1]: + video_urls.append(["[streamZ]", url]) return video_urls \ No newline at end of file