From 39e2e7712f75618c8e7eadaadb9504e4491a4ae1 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 5 May 2020 20:46:53 +0200 Subject: [PATCH 1/3] un paio di fix/migliorie --- core/httptools.py | 2 +- platformcode/platformtools.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/httptools.py b/core/httptools.py index 64cfef16..273da4ea 100755 --- a/core/httptools.py +++ b/core/httptools.py @@ -410,7 +410,7 @@ def downloadpage(url, **opt): response['data'] = req.content if req.content else '' if CF: import re - response['data'] = re.sub('"/save/[^"]*(https?://[^"]+)', '"\\1', response['data']) + response['data'] = re.sub('["|\']/save/[^"]*(https?://[^"]+)', '"\\1', response['data']) response['url'] = req.url if type(response['data']) != str: diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index b9ce7472..188ee9ba 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -196,11 +196,15 @@ def render_items(itemlist, parent_item): if item.action == 'play' and thumb_type == 1 and not item.forcethumb: item.thumbnail = "https://github.com/kodiondemand/media/raw/master/resources/servers/" + item.server.lower() + '.png' - # if cloudflare, cookies are needed to display images taken from site + # if cloudflare and cloudscraper is used, cookies are needed to display images taken from site # before checking domain (time consuming), checking if tmdb failed (so, images scraped from website are used) - # if item.action in ['findvideos'] and not item.infoLabels['tmdb_id'] and item.channel in httptools.channelsCF: - # item.thumbnail = httptools.get_url_headers(item.thumbnail) - # item.fanart = httptools.get_url_headers(item.fanart) + if item.action in ['findvideos'] and not item.infoLabels['tmdb_id']: + # faster but ugly way of checking + for d in httptools.FORCE_CLOUDSCRAPER_LIST: + if d + '/' in item.url: + item.thumbnail = httptools.get_url_headers(item.thumbnail) + item.fanart = httptools.get_url_headers(item.fanart) + break icon_image = "DefaultFolder.png" if item.folder else "DefaultVideo.png" listitem = xbmcgui.ListItem(item.title) From affdc20a65136bd1c9d3fb01e6cead258685ed20 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 6 May 2020 09:55:46 +0200 Subject: [PATCH 2/3] =?UTF-8?q?piccolo=20fix=20tag=20qaulit=C3=A0=20cb01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels/cineblog01.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channels/cineblog01.py b/channels/cineblog01.py index d64cb0d6..97d99488 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -220,7 +220,7 @@ def findvideos(item): itemlist = support.server(item, itemlist=itemlist) # Extract the quality format - patronvideos = '>([^<]+)' + patronvideos = '([\w.]+)' support.addQualityTag(item, itemlist, data, patronvideos) return itemlist From ca3f7e76fcb10e755119176e9365aad14469206a Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 6 May 2020 19:45:48 +0200 Subject: [PATCH 3/3] aggiunto contentType "music" e altri piccoli aggiustamenti --- channels/ilcorsaronero.py | 9 +++++---- channels/metalvideo.py | 5 ++++- channels/tunein.py | 1 + core/item.py | 2 +- core/support.py | 19 +++++-------------- specials/downloads.py | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/channels/ilcorsaronero.py b/channels/ilcorsaronero.py index 76624637..39941c7d 100644 --- a/channels/ilcorsaronero.py +++ b/channels/ilcorsaronero.py @@ -36,9 +36,10 @@ def mainlist(item): ('Cerca Musica.. submenu', ['/torrent-ita/2/', 'search', ['search', 'music', False]]), ('Audiolibri {musica}', ['/categoria.php?active=0&category=18&order=data&by=DESC&page=', 'peliculas', [0, 'music', False]]), ('Cerca Audiolibri.. submenu', ['/torrent-ita/18/', 'search', ['search', 'music', False]]), - ('Altro {film}', ['/categoria.php?active=0&category=4&order=data&by=DESC&page=', 'peliculas', [0, 'movie', False]]), - ('Cerca altro.. submenu', ['/torrent-ita/4/', 'search', ['search', 'movie', False]]), - ('Cerca Tutto... color kod bold', ['/argh.php?search=', 'search', ['search', 'all', False]]) + # mostrerebbe anche risultati non "multimediali" e allungherebbero inutilmente la ricerca globale + # ('Altro {film}', ['/categoria.php?active=0&category=4&order=data&by=DESC&page=', 'peliculas', [0, 'other', False]]), + # ('Cerca altro.. submenu', ['/torrent-ita/4/', 'search', ['search', 'other', False]]), + # ('Cerca Tutto... color kod bold', ['/argh.php?search=', 'search', ['search', 'all', False]]) ] return locals() @@ -47,7 +48,7 @@ def mainlist(item): @support.scrape def peliculas(item): sceneTitle = item.args[2] - if item.args[1] in ['tvshow', 'anime', 'music']: + if item.args[1] in ['tvshow', 'anime', 'music', 'other']: patron = r'>[^"<]+' else: patron = r'>(?P[^"<]+)' diff --git a/channels/metalvideo.py b/channels/metalvideo.py index 95ccad47..823bc40e 100644 --- a/channels/metalvideo.py +++ b/channels/metalvideo.py @@ -25,6 +25,7 @@ def mainlist(item): patron = r'(?P[^<]+)<' def itemHook(item): item.thumbnail = support.thumb(thumb='music.png') + item.contentType = 'music' return item def itemlistHook(itemlist): itemlist.pop(0) @@ -32,7 +33,8 @@ def mainlist(item): support.Item( channel=item.channel, title=support.typo('Cerca...', 'bold color kod'), - url = item.url, + contentType='music', + url=item.url, action='search', thumbnail=support.thumb(thumb='search.png'))) return itemlist @@ -43,6 +45,7 @@ def peliculas(item): action = 'findvideos' patron= r'<img src="[^"]+" alt="(?P<title>[^"]+)" data-echo="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)"' patronNext = r'<a href="([^"]+)">»' + typeContentDict = {'': 'music'} return locals() diff --git a/channels/tunein.py b/channels/tunein.py index 212965bc..d0d33383 100644 --- a/channels/tunein.py +++ b/channels/tunein.py @@ -21,6 +21,7 @@ def mainlist(item): patron = r'text="(?P<title>[^"]+)" URL="(?P<url>[^"]+)"' def itemHook(item): item.thumbnail = support.thumb(thumb='music.png') + item.contentType = 'music' return item def itemlistHook(itemlist): itemlist.append( diff --git a/core/item.py b/core/item.py index 5ab216ea..f3d33b9a 100644 --- a/core/item.py +++ b/core/item.py @@ -41,7 +41,7 @@ class InfoLabels(dict): # super(InfoLabels, self).__setitem__('code', value) super(InfoLabels, self).__setitem__('imdb_id', str(value)) - elif name == "mediatype" and value not in ["list", "movie", "tvshow", "season", "episode"]: + elif name == "mediatype" and value not in ["list", "movie", "tvshow", "season", "episode", "music"]: super(InfoLabels, self).__setitem__('mediatype', 'list') elif name in ['tmdb_id', 'tvdb_id', 'noscrap_id']: diff --git a/core/support.py b/core/support.py index c2dd03bc..81b3cebf 100755 --- a/core/support.py +++ b/core/support.py @@ -140,17 +140,6 @@ def regexDbg(item, patron, headers, data=''): webbrowser.open(url + "/r/" + permaLink) -def scrape2(item, patron = '', listGroups = [], headers="", blacklist="", data="", patronBlock="", - patronNext="", action="findvideos", addVideolibrary = True, typeContentDict={}, typeActionDict={}): - m = re.search(r'(?<!\\|\[)\((?!\?)', patron) - n = 0 - while m: - patron = patron[:m.end()] + '?P<' + listGroups[n] + '>' + patron[m.end():] - m = re.search(r'(?<!\\|\[)\((?!\?)', patron) - n += 1 - regexDbg(item, patron, headers) - - def scrapeLang(scraped, lang, longtitle): ## Aggiunto/modificato per gestire i siti che hanno i video ## in ita e subita delle serie tv nella stessa pagina @@ -485,7 +474,7 @@ def scrape(func): page=pag + 1, thumbnail=thumb())) - if action != 'play' and function != 'episodios' and 'patronMenu' not in args: + if action != 'play' and function != 'episodios' and 'patronMenu' not in args and item.contentType in ['movie', 'tvshow', 'episode']: tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) from specials import autorenumber @@ -959,11 +948,13 @@ def download(itemlist, item, typography='', function_level=1, function=''): elif item.contentType == 'episode': from_action = 'findvideos' title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title - else: + elif item.contentType == 'tvshow': from_action = 'episodios' title = typo(config.get_localized_string(60355), typography) + else: # content type does not support download + return itemlist - function = function if function else inspect.stack()[function_level][3] + # function = function if function else inspect.stack()[function_level][3] contentSerieName=item.contentSerieName if item.contentSerieName else '' contentTitle=item.contentTitle if item.contentTitle else '' diff --git a/specials/downloads.py b/specials/downloads.py index 637a0c1b..ac055b5c 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -386,7 +386,7 @@ def move_to_libray(item): filetools.remove(library_path) if filetools.isfile(download_path): - if filetools.move(download_path, library_path): + if filetools.move(download_path, library_path, silent=True): final_path = library_path if len(filetools.listdir(filetools.dirname(download_path))) == 0: