diff --git a/addon.xml b/addon.xml index a096c0ad..d739da20 100644 --- a/addon.xml +++ b/addon.xml @@ -1,4 +1,4 @@ - + @@ -26,12 +26,9 @@ resources/media/themes/ss/2.png resources/media/themes/ss/3.png - - Migliorato Menu Rapido -- Rimosso Menu Laterale -- Fix Youtube -- Fix Visualizza collegamenti della videoteca come pop-up -- Riorganizzata sezione Aiuto -- Reinserito canale tantifilm + - correzioni di alcuni bug (citiamo ad esempio il crash con il refresh rate e l'impossibilita di entrare nel menu server bloccati) +- fix per cambio di struttura a qualche canale/server +- migliorie interne Naviga velocemente sul web e guarda i contenuti presenti [COLOR red]The owners and submitters to this addon do not host or distribute any of the content displayed by these addons nor do they have any affiliation with the content providers.[/COLOR] [COLOR yellow]Kodi © is a registered trademark of the XBMC Foundation. We are not connected to or in any other way affiliated with Kodi, Team Kodi, or the XBMC Foundation. Furthermore, any software, addons, or products offered by us will receive no support in official Kodi channels, including the Kodi forums and various social networks.[/COLOR] diff --git a/channels.json b/channels.json index d748193f..55ae624e 100644 --- a/channels.json +++ b/channels.json @@ -1,8 +1,8 @@ { "direct": { - "altadefinizione01_link": "https://altadefinizione01.tips", + "altadefinizione01_link": "https://altadefinizione01.fitness", "animealtadefinizione": "https://www.animealtadefinizione.it", - "animeforce": "https://ww1.animeforce.org", + "animeforce": "https://www.animeforce.it", "animeleggendari": "https://animeora.com", "animesaturn": "https://www.animesaturn.it", "animestream": "https://www.animeworld.tv", @@ -17,7 +17,7 @@ "cinetecadibologna": "http://cinestore.cinetecadibologna.it", "dreamsub": "https://dreamsub.stream", "dsda": "https://www.dsda.press", - "eurostreaming": "https://eurostreaming.chat", + "eurostreaming": "https://eurostreaming.chat", "fastsubita": "https://fastsubita.xyz", "filmgratis": "https://www.filmaltadefinizione.me", "filmigratis": "https://filmigratis.org", @@ -25,16 +25,17 @@ "filmstreaming01": "https://filmstreaming01.com", "guardaserie_stream": "https://guardaserie.host", "guardaseriecam": "https://guardaserie.cam", - "guardaserieclick": "https://www.guardaserie.date", - "guardaserieicu": "https://guardaserie.today", + "guardaserieclick": "https://www.guardaserie.directory", + "guardaserieicu": "https://guardaserie.shop", "hd4me": "https://hd4me.net", "ilcorsaronero": "https://ilcorsaronero.link", "ilgeniodellostreaming": "https://ilgeniodellostreaming.cat", "ilgeniodellostreaming_cam": "https://ilgeniodellostreaming.gold", - "italiaserie": "https://italiaserie.best", + "italiaserie": "https://italiaserie.top", "mediasetplay": "https://www.mediasetplay.mediaset.it", "mondoserietv": "https://mondoserietv.fun", - "piratestreaming": "https://www.piratestreaming.date", + "paramount": "https://www.paramountnetwork.it", + "piratestreaming": "https://www.piratestreaming.camp", "polpotv": "https://roma.polpo.tv", "raiplay": "https://www.raiplay.it", "serietvonline": "https://serietvonline.cam", diff --git a/channels/animesaturn.py b/channels/animesaturn.py index e303929f..e4696377 100644 --- a/channels/animesaturn.py +++ b/channels/animesaturn.py @@ -60,7 +60,7 @@ def newest(categoria): def submenu(item): data = support.match(item.url + item.args).data action = 'filter' - patronMenu = r'
(?P[^<]+)[^>]+>[^>]+>\s*<select id="(?P<parameter>[^"]+)"[^>]+>(?P<url>.*?)</select>' + patronMenu = r'<h5 class="[^"]+">(?P<title>[^<]+)[^>]+>[^>]+>\s*<select id="(?P<parameter>[^"]+)"[^>]+>(?P<data>.*?)</select>' def itemlistHook(itemlist): itemlist.insert(0, item.clone(title=support.typo('Tutti','bold'), url=item.url + item.args, action='peliculas')) return itemlist[:-1] @@ -69,7 +69,7 @@ def submenu(item): def filter(item): itemlist = [] - matches = support.match(item.url, patron=r'<option value="(?P<value>[^"]+)"[^>]*>(?P<title>[^<]+)').matches + matches = support.match(item.data if item.data else item.url, patron=r'<option value="(?P<value>[^"]+)"[^>]*>(?P<title>[^<]+)').matches for value, title in matches: itemlist.append(item.clone(title= support.typo(title,'bold'), url='{}{}&{}%5B0%5D={}'.format(host, item.args, item.parameter, value), action='peliculas', args='filter')) support.thumb(itemlist, genre=True) @@ -95,7 +95,7 @@ def peliculas(item): deflang= 'Sub-ITA' action = 'check' page = None - post = "page=" + str(item.page if item.page else 1) if item.page and item.page > 1 else None + post = "page=" + str(item.page if item.page else 1) if item.page and int(item.page) > 1 else None if item.args == 'top': data = item.other diff --git a/channels/casacinema.py b/channels/casacinema.py index df59d713..375d4ff7 100644 --- a/channels/casacinema.py +++ b/channels/casacinema.py @@ -6,7 +6,6 @@ from core import support - host = support.config.get_channel_url() headers = [['Referer', host]] diff --git a/channels/filmpertutti.py b/channels/filmpertutti.py index ffc098b9..4c9e9164 100644 --- a/channels/filmpertutti.py +++ b/channels/filmpertutti.py @@ -35,16 +35,17 @@ def mainlist(item): @support.scrape def peliculas(item): support.info() - # debug = True + #debug = True + #debugBlock = True if item.args != 'newest': patronBlock = r'<ul class="posts">(?P<block>.*)<\/ul>' - patron = r'<li><a href="(?P<url>[^"]+)" data-thumbnail="(?P<thumb>[^"]+)">.*?<div class="title">(?P<title>.+?)(?:\[(?P<lang>Sub-ITA)\])?(?:[ ]\[?(?P<quality>[HD]+)?\])?(?:[ ]\((?P<year>\d+)\)?)?<\/div>' + patron = r'<li><a href="(?P<url>[^"]+)" data-thumbnail="(?P<thumb>[^"]+)">.*?<div class="title[^"]*">(?P<title>.+?)(?:\[(?P<lang>Sub-ITA)\])?(?:[ ]\[?(?P<quality>[HD]+)?\])?(?:[ ]\((?P<year>\d+)\)?)?<\/div>' patronNext = r'<a href="([^"]+)" >Pagina' else: - patronBlock = r'<ul class="posts">(?P<block>.*)<div class="clear">' - patron = r'<li>\s?<a href="(?P<url>[^"]+)" data-thumbnail="(?P<thumb>[^"]+)">.*?<div class="title">(?P<title>.+?)(?:\s\[(?P<quality>HD)\])?<\/div><div class="episode"[^>]+>(?P<episode>[^<(]+)(?:\((?P<lang>[a-zA-Z\-]+)\))?' + patronBlock = r'<ul class="posts">(?P<block>.*)<div class="clear[^"]*">' + patron = r'<li>\s?<a href="(?P<url>[^"]+)" data-thumbnail="(?P<thumb>[^"]+)">.*?<div class="title[^"]*">(?P<title>.+?)(?:\s\[(?P<quality>HD)\])?<\/div><div class="episode[^"]*"[^>]+>(?P<episode>[^<(]+)(?:\((?P<lang>[a-zA-Z\-]+)\))?' pagination = '' if item.args == 'search': diff --git a/channels/italiaserie.py b/channels/italiaserie.py index e7a75716..f071cbec 100644 --- a/channels/italiaserie.py +++ b/channels/italiaserie.py @@ -17,8 +17,7 @@ def mainlist(item): tvshow = ['', ('Aggiornamenti', ['/aggiornamento-episodi/', 'peliculas', 'update']), ('Top 10', ['/top-10', 'peliculas', 'top']), - ('Netflix {tv submenu}', ['/genere/netflix', 'peliculas']), - ('A-Z', ['/lista-completa', 'peliculas', 'a-z']) + ('Netflix {tv submenu}', ['/genere/netflix', 'peliculas']) ] return locals() @@ -26,13 +25,14 @@ def mainlist(item): @support.scrape def peliculas(item): + blacklist = ['Aggiornamento Episodi'] action = 'episodios' patron = r'<div class="post-thumb">\s*<a href="(?P<url>[^"]+)" title="(?P<title>[^"\[]+)[^>]+>\s*<img src="(?P<thumb>[^"]+)"[^>]+>' if item.args == 'update': pagination = '' - patron = r'br />(?P<title>[^–]+)[^<]+<a href="(?P<url>[^"]+)">(?P<episode>[^ ]+)\s*(?P<title2>[^\(<]+)(?:\((?P<lang>[^\)]+))??' - action = 'findvideos' + patron = r'br />(?:[^>]+>)?(?P<title>[^–]+)[^<]+<a href="(?P<url>[^"]+)">(?P<episode>[^ ]+)\s*(?P<title2>[^\(<]+)(?:\((?P<lang>[^\)]+))?' + action = 'episodios' if item.args == 'top': patron = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a>[^>]+>[^>]+>[^>]+><img.*?src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>:\s*(?P<rating>[^/]+)' if item.args =='a-z': @@ -89,7 +89,7 @@ def newest(categoria): item = Item() try: if categoria == "series": - item.url = host + "/ultimi-episodi/" + item.url = host + "/aggiornamento-episodi/" item.action = "peliculas" item.args = "update" item.contentType = "episode" @@ -110,20 +110,5 @@ def newest(categoria): def findvideos(item): logger.debug() - - if item.args == 'update': - itemlist = [] - item.infoLabels['mediatype'] = 'episode' - - data = support.match(item.url, headers=headers).data - url_video = support.match(data, patron=r'<a rel="[^"]+" target="[^"]+" act="[^"]+"\s+href="([^"]+)" class="[^"]+-link".+?\d+.+?</strong> </a>').matches - url_serie = support.match(data, patron=r'<link rel="canonical" href="([^"]+)" />').matches - goseries = support.typo("Vai alla Serie:", ' bold') - series = support.typo(item.contentSerieName, ' bold color kod') - itemlist = support.server(item, data=url_video) - - itemlist.append(item.clone(title=goseries + series, contentType='tvshow', url=url_serie, action='episodios', plot = goseries + series + "con tutte le puntate")) - - return itemlist - else: - return support.server(item, data=item.data) + data = support.match(item.data, patron=r'href="([^"]+)').matches + return support.server(item, data=data) diff --git a/channels/paramount.py b/channels/paramount.py index f1d33281..aed03c53 100644 --- a/channels/paramount.py +++ b/channels/paramount.py @@ -6,8 +6,7 @@ import inspect from core import support, jsontools from platformcode import autorenumber, logger -# host = support.config.get_channel_url() -host = 'https://www.paramountnetwork.it' +host = support.config.get_channel_url() headers = [['Referer', host]] @@ -64,7 +63,7 @@ def live(item): def peliculas(item): logger.debug() def load_more(url): - second_url = host if url.startswith('/') else '' + url.replace('\u002F','/').replace('%5C','/') + second_url = host if url.startswith('/') else '' + url.replace('\u002F','/').replace('\\u002F','/').replace('%5C','/') new_data = support.match(host + second_url).data.replace('\x01','l').replace('\x02','a') return jsontools.load(new_data)['items'] diff --git a/channels/raiplay.py b/channels/raiplay.py index e1b5bf8a..f66ef901 100644 --- a/channels/raiplay.py +++ b/channels/raiplay.py @@ -53,7 +53,7 @@ def learning(item): json = current_session.get(item.url).json()['contents'] for key in json: itemlist.append(item.clone(title = support.typo(key['name'],'bold'), fulltitle = key['name'], - show = key['name'], url = key['contents'], action = 'peliculas')) + show = key['name'], data = key['contents'], action = 'peliculas')) return itemlist @@ -82,9 +82,14 @@ def replay_menu(item): # create day and month list days = [] months = [] - days.append(xbmc.getLocalizedString(17)) - for day in range(11, 17): days.append(xbmc.getLocalizedString(day)) - for month in range(21, 33): months.append(xbmc.getLocalizedString(month)) + try: + days.append(xbmc.getLocalizedString(17)) + for day in range(11, 17): days.append(xbmc.getLocalizedString(day)) + for month in range(21, 33): months.append(xbmc.getLocalizedString(month)) + except: # per i test, xbmc.getLocalizedString non è supportato + days.append('dummy') + for day in range(11, 17): days.append('dummy') + for month in range(21, 33): months.append('dummy') # make menu itemlist = [] @@ -184,8 +189,8 @@ def peliculas(item): pagination = 40 if not item.search else '' # load json - if type(item.url) in [dict, list]: - json = item.url + if item.data: + json = item.data for key in json: if item.search.lower() in key['name'].lower(): keys.append(key) diff --git a/channels/serietvsubita.json b/channels/serietvsubita.json index b087171f..2cd33c2f 100644 --- a/channels/serietvsubita.json +++ b/channels/serietvsubita.json @@ -1,7 +1,7 @@ { "id": "serietvsubita", "name": "Serie TV Sub ITA", - "active": true, + "active": false, "language": ["ita"], "thumbnail": "serietvsubita.png", "banner": "serietvsubita.png", diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index 8fcb2ac6..2891b180 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -4,7 +4,7 @@ # ------------------------------------------------------------ import json, requests, sys -from core import support +from core import support, channeltools from platformcode import logger if sys.version_info[0] >= 3: from concurrent import futures @@ -190,5 +190,21 @@ def episodios(item): def findvideos(item): - itemlist = [item.clone(title = 'StreamingCommunity', server='streamingcommunity_server')] + video_urls = [] + headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14', + 'content-type': 'application/json;charset=UTF-8', + 'Referer': 'https://streamingcommunity.net'} + data = support.match(item, headers=headers).data.replace('"','"').replace('\\','') + url = support.match(data, patron=r'video_url"\s*:\s*"([^"]+)"').match + def videourls(res): + newurl = '{}/{}'.format(url, res) + if requests.head(newurl, headers=headers).status_code == 200: + video_urls.append(["m3u8 {} [StreamingCommunity]".format(res), newurl]) + + with futures.ThreadPoolExecutor() as executor: + for res in ['480p', '720p', '1080p']: + executor.submit(videourls, res) + if not video_urls: video_urls = [["m3u8 [StreamingCommunity]", url]] + else: video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match)) + itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=video_urls, thumbnail=channeltools.get_channel_parameters(item.channel)["thumbnail"], forcethumb=True)] return support.server(item, itemlist=itemlist) \ No newline at end of file diff --git a/core/autoplay.py b/core/autoplay.py index af904cad..4f3c3dff 100644 --- a/core/autoplay.py +++ b/core/autoplay.py @@ -153,11 +153,13 @@ def start(itemlist, item): autoplay_list.append(autoplay_elem) # We order according to priority - if priority == 0: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Servers and qualities + if priority == 0: autoplay_list.sort(key=lambda orden: ((orden['indice_server'], orden['indice_quality']))) # Servers and qualities elif priority == 1: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Qualities and servers elif priority == 2: autoplay_list.sort(key=lambda orden: (orden['indice_server'])) # Servers only elif priority == 3: autoplay_list.sort(key=lambda orden: (orden['indice_quality'])) # Only qualities + logger.debug('PRIORITY',priority, autoplay_list) + # if quality priority is active if priority == 0 and config.get_setting('quality_priority'): max_quality = autoplay_list[0]["indice_quality"] if autoplay_list and "indice_quality" in autoplay_list[0] else 0 diff --git a/core/support.py b/core/support.py index 3be458cc..92eb46d4 100755 --- a/core/support.py +++ b/core/support.py @@ -217,46 +217,12 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t val = domain + val scraped[kk] = val.strip() if type(val) == str else val - episode = '' - if not group or item.grouped: - if scraped['season'] and scraped['episode']: - stagione = scraped['season'] - ep = unifyEp(scraped['episode']) - if 'x' in ep: - episode = ep.split('x')[0].strip() - second_episode = ep.split('x')[1].strip() - else: - episode = ep - second_episode = '' - item.infoLabels['season'] = int(scraped['season']) - item.infoLabels['episode'] = int(episode) - episode = str(int(scraped['season'])) +'x'+ str(int(episode)).zfill(2) + ('x' + str(int(second_episode)).zfill(2) if second_episode else '') - elif item.season: - item.infoLabels['season'] = int(item.season) - item.infoLabels['episode'] = int(scrapertools.find_single_match(scraped['episode'], r'(\d+)')) - episode = item.season +'x'+ scraped['episode'] - elif item.contentType == 'tvshow' and (scraped['episode'] == '' and scraped['season'] == '' and stagione == ''): - item.news = 'season_completed' - episode = '' - else: - episode = unifyEp(scraped['episode']) if scraped['episode'] else '' - try: - if 'x' in episode: - ep = episode.split('x') - episode = str(int(ep[0])).zfill(1) + 'x' + str(int(ep[1])).zfill(2) - item.infoLabels['season'] = int(ep[0]) - item.infoLabels['episode'] = int(ep[1]) - second_episode = scrapertools.find_single_match(episode, r'x\d+x(\d+)') - if second_episode: episode = re.sub(r'(\d+x\d+)x\d+',r'\1-', episode) + second_episode.zfill(2) - except: - logger.debug('invalid episode: ' + episode) - pass - - #episode = re.sub(r'\s-\s|-|x|–|×', 'x', scraped['episode']) if scraped['episode'] else '' + # episode = re.sub(r'\s-\s|-|x|–|×', 'x', scraped['episode']) if scraped['episode'] else '' title = cleantitle(scraped.get('title', '')) if group and scraped.get('title', '') in contents and not item.grouped: # same title and grouping enabled continue - if item.grouped and scraped.get('title', '') != item.fulltitle: # inside a group different tvshow should not be included + if item.grouped and scraped.get('title', + '') != item.fulltitle: # inside a group different tvshow should not be included continue contents.append(title) title2 = cleantitle(scraped.get('title2', '')) if not group or item.grouped else '' @@ -278,7 +244,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t if scraped["plot"]: infolabels['plot'] = plot if scraped['duration']: - matches = scrapertools.find_multiple_matches(scraped['duration'],r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)') + matches = scrapertools.find_multiple_matches(scraped['duration'], + r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)') for h, m in matches: scraped['duration'] = int(h) * 60 + int(m) if not matches: @@ -293,6 +260,41 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t if scraped["rating"]: infolabels['rating'] = scrapertools.decodeHtmlentities(scraped["rating"]) + episode = '' + if not group or item.grouped: + if scraped['season'] and scraped['episode']: + stagione = scraped['season'] + ep = unifyEp(scraped['episode']) + if 'x' in ep: + episode = ep.split('x')[0].strip() + second_episode = ep.split('x')[1].strip() + else: + episode = ep + second_episode = '' + infolabels['season'] = int(scraped['season']) + infolabels['episode'] = int(episode) + episode = str(int(scraped['season'])) +'x'+ str(int(episode)).zfill(2) + ('x' + str(int(second_episode)).zfill(2) if second_episode else '') + elif item.season: + infolabels['season'] = int(item.season) + infolabels['episode'] = int(scrapertools.find_single_match(scraped['episode'], r'(\d+)')) + episode = item.season +'x'+ scraped['episode'] + elif item.contentType == 'tvshow' and (scraped['episode'] == '' and scraped['season'] == '' and stagione == ''): + item.news = 'season_completed' + episode = '' + else: + episode = unifyEp(scraped['episode']) if scraped['episode'] else '' + try: + if 'x' in episode: + ep = episode.split('x') + episode = str(int(ep[0])).zfill(1) + 'x' + str(int(ep[1])).zfill(2) + infolabels['season'] = int(ep[0]) + infolabels['episode'] = int(ep[1]) + second_episode = scrapertools.find_single_match(episode, r'x\d+x(\d+)') + if second_episode: episode = re.sub(r'(\d+x\d+)x\d+',r'\1-', episode) + second_episode.zfill(2) + except: + logger.debug('invalid episode: ' + episode) + pass + # make formatted Title [longtitle] s = ' - ' # title = episode + (s if episode and title else '') + title @@ -318,24 +320,26 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t if type(parsedTitle.get('season')) == list: longtitle += str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) + infolabels['season'] = parsedTitle.get('season')[0] else: longtitle += str(parsedTitle.get('season')) + infolabels['season'] = parsedTitle.get('season') if type(parsedTitle.get('episode')) == list: longtitle += 'x' + str(parsedTitle.get('episode')[0]).zfill(2) + '-' + str(parsedTitle.get('episode')[-1]).zfill(2) + infolabels['episode'] = parsedTitle.get('episode')[0] else: longtitle += 'x' + str(parsedTitle.get('episode')).zfill(2) + infolabels['episode'] = parsedTitle.get('episode') - item.contentSeason = parsedTitle.get('season') - item.contentEpisodeNumber = parsedTitle.get('episode') elif parsedTitle.get('season') and type(parsedTitle.get('season')) == list: longtitle += s + config.get_localized_string(30140) + " " +str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) elif parsedTitle.get('season'): longtitle += s + config.get_localized_string(60027) % str(parsedTitle.get('season')) - item.contentSeason = parsedTitle.get('season') + infolabels['season'] = parsedTitle.get('season') if parsedTitle.get('episode_title'): longtitle += s + parsedTitle.get('episode_title') - item.contentEpisodeTitle = parsedTitle.get('episode_title') + infolabels['episodeName'] = parsedTitle.get('episode_title') except: import traceback logger.error(traceback.format_exc()) @@ -1159,25 +1163,26 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru # s = servertools.get_server_from_url(videoitem.url) # videoitem.server = s[2] if s else 'directo' # videoitem.title = s[0] if s else config.get_localized_string(30137) - srv_param = servertools.get_server_parameters(videoitem.server.lower()) - if not srv_param: # do not exists or it's empty - findS = servertools.get_server_from_url(videoitem.url) - info(findS) - if not findS: - if item.channel == 'community': - findS= (config.get_localized_string(30137), videoitem.url, 'directo') - else: - videoitem.url = unshortenit.unshorten_only(videoitem.url)[0] - findS = servertools.get_server_from_url(videoitem.url) - if not findS: - info(videoitem, 'Non supportato') - return - videoitem.server = findS[2] - videoitem.title = findS[0] - videoitem.url = findS[1] + if not videoitem.video_urls: srv_param = servertools.get_server_parameters(videoitem.server.lower()) + if not srv_param: # do not exists or it's empty + findS = servertools.get_server_from_url(videoitem.url) + info(findS) + if not findS: + if item.channel == 'community': + findS= (config.get_localized_string(30137), videoitem.url, 'directo') + else: + videoitem.url = unshortenit.unshorten_only(videoitem.url)[0] + findS = servertools.get_server_from_url(videoitem.url) + if not findS: + info(videoitem, 'Non supportato') + return + videoitem.server = findS[2] + videoitem.title = findS[0] + videoitem.url = findS[1] + srv_param = servertools.get_server_parameters(videoitem.server.lower()) - if srv_param.get('active', False): + if videoitem.video_urls or srv_param.get('active', False): item.title = typo(item.contentTitle.strip(), 'bold') if item.contentType == 'movie' or (config.get_localized_string(30161) in item.title) else item.title quality = videoitem.quality if videoitem.quality else item.quality if item.quality else '' @@ -1186,7 +1191,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru videoitem.channel = item.channel videoitem.fulltitle = item.fulltitle videoitem.show = item.show - videoitem.thumbnail = item.thumbnail + if not videoitem.video_urls: videoitem.thumbnail = item.thumbnail videoitem.contentType = item.contentType videoitem.infoLabels = item.infoLabels videoitem.quality = quality @@ -1198,13 +1203,13 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru # non threaded for webpdb # dbg() - # thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url] + # thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls] # for it in thL: # if it and not config.get_setting("black_list", server=it.server.lower()): # verifiedItemlist.append(it) - # + with futures.ThreadPoolExecutor() as executor: - thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url] + thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls] for it in futures.as_completed(thL): if it.result() and not config.get_setting("black_list", server=it.result().server.lower()): verifiedItemlist.append(it.result()) diff --git a/lib/unshortenit.py b/lib/unshortenit.py index 0bcb8c87..538a568c 100644 --- a/lib/unshortenit.py +++ b/lib/unshortenit.py @@ -31,7 +31,7 @@ class UnshortenIt(object): _linkbucks_regex = r'linkbucks\.com|any\.gs|cash4links\.co|cash4files\.co|dyo\.gs|filesonthe\.net|goneviral\.com|megaline\.co|miniurls\.co|qqc\.co|seriousdeals\.net|theseblogs\.com|theseforums\.com|tinylinks\.co|tubeviral\.com|ultrafiles\.net|urlbeat\.net|whackyvidz\.com|yyv\.co' _adfocus_regex = r'adfoc\.us' _lnxlu_regex = r'lnx\.lu' - _shst_regex = r'sh\.st|festyy\.com|ceesty\.com' + _shst_regex = r'sh\.st|shorte\.st|sh\.st|clkmein\.com|viid\.me|xiw34\.com|corneey\.com|gestyy\.com|cllkme\.com|festyy\.com|destyy\.com|ceesty\.com' _hrefli_regex = r'href\.li' _anonymz_regex = r'anonymz\.com' _shrink_service_regex = r'shrink-service\.it' @@ -41,6 +41,7 @@ class UnshortenIt(object): _linkhub_regex = r'linkhub\.icu' _swzz_regex = r'swzz\.xyz' _stayonline_regex = r'stayonline\.pro' + _snip_regex = r'[0-9a-z]+snip\.|uprotector\.xyz' # for services that only include real link inside iframe _simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club' # for services that only do redirects @@ -48,7 +49,7 @@ class UnshortenIt(object): listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex, _shrink_service_regex, _rapidcrypt_regex, _simple_iframe_regex, _vcrypt_regex, _linkup_regex, _linkhub_regex, - _swzz_regex, _stayonline_regex, _simple_redirect] + _swzz_regex, _stayonline_regex, _snip_regex, _simple_redirect] _maxretries = 5 @@ -94,6 +95,8 @@ class UnshortenIt(object): uri, code = self._unshorten_swzz(uri) if re.search(self._stayonline_regex, uri, re.IGNORECASE): uri, code = self._unshorten_stayonline(uri) + if re.search(self._snip_regex, uri, re.IGNORECASE): + uri, code = self._unshorten_snip(uri) if re.search(self._simple_redirect, uri, re.IGNORECASE): p = httptools.downloadpage(uri) uri = p.url @@ -381,41 +384,43 @@ class UnshortenIt(object): def _unshorten_shst(self, uri): try: - r = httptools.downloadpage(uri, timeout=self._timeout) - html = r.data - session_id = re.findall(r'sessionId\:(.*?)\"\,', html) - if len(session_id) > 0: - session_id = re.sub(r'\s\"', '', session_id[0]) - - http_header = dict() - http_header["Content-Type"] = "application/x-www-form-urlencoded" - http_header["Host"] = "sh.st" - http_header["Referer"] = uri - http_header["Origin"] = "http://sh.st" - http_header["X-Requested-With"] = "XMLHttpRequest" - - if config.is_xbmc(): - import xbmc - xbmc.sleep(5 * 1000) - else: - time.sleep(5 * 1000) - - payload = {'adSessionId': session_id, 'callback': 'c'} - r = httptools.downloadpage( - 'http://sh.st/shortest-url/end-adsession?' + - urlencode(payload), - headers=http_header, - timeout=self._timeout) - response = r.data[6:-2].decode('utf-8') - - if r.code == 200: - resp_uri = json.loads(response)['destinationUrl'] - if resp_uri is not None: - uri = resp_uri - else: - return uri, 'Error extracting url' - else: - return uri, 'Error extracting url' + # act like a crawler + r = httptools.downloadpage(uri, timeout=self._timeout, headers=[['User-Agent', '']]) + uri = r.url + # html = r.data + # session_id = re.findall(r'sessionId\:(.*?)\"\,', html) + # if len(session_id) > 0: + # session_id = re.sub(r'\s\"', '', session_id[0]) + # + # http_header = dict() + # http_header["Content-Type"] = "application/x-www-form-urlencoded" + # http_header["Host"] = "sh.st" + # http_header["Referer"] = uri + # http_header["Origin"] = "http://sh.st" + # http_header["X-Requested-With"] = "XMLHttpRequest" + # + # if config.is_xbmc(): + # import xbmc + # xbmc.sleep(5 * 1000) + # else: + # time.sleep(5 * 1000) + # + # payload = {'adSessionId': session_id, 'callback': 'c'} + # r = httptools.downloadpage( + # 'http://sh.st/shortest-url/end-adsession?' + + # urlencode(payload), + # headers=http_header, + # timeout=self._timeout) + # response = r.data[6:-2].decode('utf-8') + # + # if r.code == 200: + # resp_uri = json.loads(response)['destinationUrl'] + # if resp_uri is not None: + # uri = resp_uri + # else: + # return uri, 'Error extracting url' + # else: + # return uri, 'Error extracting url' return uri, r.code @@ -540,25 +545,6 @@ class UnshortenIt(object): logger.error('IP bannato da vcrypt, aspetta un ora') else: uri = r.headers['location'] - if "snip." in uri: - new_uri = '' - if 'out_generator' in uri: - uri = re.findall('url=(.*)$', uri)[0] - elif '/decode/' in uri: - scheme, netloc, path, query, fragment = urlsplit(uri) - splitted = path.split('/') - splitted[1] = 'outlink' - r = httptools.downloadpage(uri, follow_redirects=False, post={'url': splitted[2]}) - if 'location' in r.headers and r.headers['location']: - new_uri = r.headers['location'] - else: - r = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, follow_redirects=False, post={'url': splitted[2]}) - if 'location' in r.headers and r.headers['location']: - new_uri = r.headers['location'] - if new_uri and new_uri != uri: - uri = new_uri - # uri = decrypt(uri.split('/')[-1]) - return uri, r.code if r else 200 except Exception as e: logger.error(e) @@ -665,6 +651,26 @@ class UnshortenIt(object): except Exception as e: return uri, str(e) + def _unshorten_snip(self, uri): + new_uri = '' + if 'out_generator' in uri: + uri = re.findall('url=(.*)$', uri)[0] + elif '/decode/' in uri: + scheme, netloc, path, query, fragment = urlsplit(uri) + splitted = path.split('/') + splitted[1] = 'outlink' + r = httptools.downloadpage(uri, follow_redirects=False, post={'url': splitted[2]}) + if 'location' in r.headers and r.headers['location']: + new_uri = r.headers['location'] + else: + r = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, + follow_redirects=False, post={'url': splitted[2]}) + if 'location' in r.headers and r.headers['location']: + new_uri = r.headers['location'] + if new_uri and new_uri != uri: + uri = new_uri + return uri, 200 + def unwrap_30x_only(uri, timeout=10): unshortener = UnshortenIt() @@ -691,10 +697,13 @@ def findlinks(text): unshortener = UnshortenIt() matches = [] - for regex in unshortener.listRegex: - regex = '(?:https?://(?:[\w\d]+\.)?)?(?:' + regex + ')/[a-zA-Z0-9_=/]+' - for match in re.findall(regex, text): - matches.append(match) + regex = '(?:https?://(?:[\w\d]+\.)?)?(?:' + for rg in unshortener.listRegex: + regex += rg + '|' + regex = regex[:-1] + ')/[a-zA-Z0-9_=/]+' + for match in re.findall(regex, text): + matches.append(match) + logger.info('matches=' + str(matches)) if len(matches) == 1: text += '\n' + unshorten(matches[0])[0] diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index f6e6eca6..61aa1d0b 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -48,18 +48,12 @@ def dialog_notification(heading, message, icon=3, time=5000, sound=True): def dialog_yesno(heading, message, nolabel=config.get_localized_string(70170), yeslabel=config.get_localized_string(30022), autoclose=0, customlabel=None): - # customlabel only on kodi 19 dialog = xbmcgui.Dialog() - if PY3: - if autoclose: - return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel, autoclose=autoclose) - else: - return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel) + # customlabel only work on kodi 19 + if PY3 and customlabel: + return dialog.yesnocustom(heading, message, customlabel=customlabel, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose) else: - if autoclose: - return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose) - else: - return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel) + return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose) def dialog_select(heading, _list, preselect=0, useDetails=False): diff --git a/platformcode/xbmc_config_menu.py b/platformcode/xbmc_config_menu.py index 973185f6..1f4eb411 100644 --- a/platformcode/xbmc_config_menu.py +++ b/platformcode/xbmc_config_menu.py @@ -402,24 +402,17 @@ class SettingsWindow(xbmcgui.WindowXMLDialog): label=c["label"], font=self.font, textColor=c["color"], focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'), noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png')) - elif xbmcgui.__version__ in ["3.0", "3.0.0"]: - control = xbmcgui.ControlRadioButton(0, -100, self.controls_width + 20, - self.height_control, label=c["label"], font=self.font, - textColor=c["color"], - focusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), - noFocusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), - focusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'), - noFocusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png')) else: control = xbmcgui.ControlRadioButton(0, -100, self.controls_width + 20, self.height_control, label=c["label"], font=self.font, textColor=c["color"], - focusTexture='', - noFocusTexture='', + focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'), + noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'), focusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), noFocusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), focusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'), noFocusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png')) + image = xbmcgui.ControlImage(0, -100, self.controls_width + 10, self.height_control, os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png')) self.addControl(image) self.addControl(control) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index f098276c..5f46e6e7 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -320,7 +320,7 @@ msgid "It seems that the Channel %s no longer exists." msgstr "" msgctxt "#30133" -msgid "Do you want to remove links from this channel?" +msgid "Do you want to remove ALL links from this channel?" msgstr "" msgctxt "#30135" @@ -665,7 +665,7 @@ msgid "No connector for the server %s" msgstr "" msgctxt "#60005" -msgid "" +msgid "Deleting all links from channel %s" msgstr "" msgctxt "#60006" @@ -3025,7 +3025,7 @@ msgid "Search by director" msgstr "" msgctxt "#70048" -msgid " My Account" +msgid "My Account" msgstr "" msgctxt "#70049" @@ -3057,7 +3057,7 @@ msgid "Watchlists" msgstr "" msgctxt "#70056" -msgid "Viewed" +msgid "Recently Watched" msgstr "" msgctxt "#70057" diff --git a/resources/language/resource.language.it_it/strings.po b/resources/language/resource.language.it_it/strings.po index fd0f8ba8..ac6fa323 100644 --- a/resources/language/resource.language.it_it/strings.po +++ b/resources/language/resource.language.it_it/strings.po @@ -320,8 +320,8 @@ msgid "It seems that the Channel %s no longer exists." msgstr "Sembra che il canale %s non esista più." msgctxt "#30133" -msgid "Do you want to remove links from this channel?" -msgstr "Vuoi rimuovere i collegamenti da questo canale?" +msgid "Do you want to remove ALL links from this channel?" +msgstr "Vuoi rimuovere TUTTI i collegamenti da questo canale?" msgctxt "#30135" msgid "The movie "%s" has been added to the video library" @@ -664,8 +664,8 @@ msgid "No connector for the server %s" msgstr "Non c'è nessun connettore per il server %s" msgctxt "#60005" -msgid "" -msgstr "" +msgid "Deleting all links from channel %s" +msgstr "Eliminando tutti i link del canale %s" msgctxt "#60006" msgid "[B]An error has occurred in %s:[/B]" @@ -3024,8 +3024,8 @@ msgid "Search by director" msgstr "Cerca per regista" msgctxt "#70048" -msgid " My Account" -msgstr " Il Mio Account" +msgid "My Account" +msgstr "Il Mio Account" msgctxt "#70049" msgid "Most Popular" @@ -3053,11 +3053,11 @@ msgstr "Collega il tuo account trakt" msgctxt "#70055" msgid "Watchlists" -msgstr "Lista Osservati" +msgstr "Watchlist" msgctxt "#70056" -msgid "Viewed" -msgstr "Visti" +msgid "Recently Watched" +msgstr "Guardato di Recente" msgctxt "#70057" msgid "My lists" diff --git a/resources/skins/Default/720p/ChannelSettings.xml b/resources/skins/Default/720p/ChannelSettings.xml index ebb5d276..664b284b 100644 --- a/resources/skins/Default/720p/ChannelSettings.xml +++ b/resources/skins/Default/720p/ChannelSettings.xml @@ -44,9 +44,9 @@ <!-- CLOSE BUTTON --> <control type="button" id="10003"> <right>30</right> - <top>25</top> - <width>30</width> - <height>30</height> + <top>20</top> + <width>40</width> + <height>40</height> <texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus> <texturenofocus colordiffuse="55FFFFFF">close.png</texturenofocus> </control> diff --git a/servers/speedvideo.json b/servers/speedvideo.json index 55bf2d00..3ef4a00b 100644 --- a/servers/speedvideo.json +++ b/servers/speedvideo.json @@ -5,7 +5,7 @@ "patterns": [ { "pattern": "speedvideo.net/(?:embed-|)(?!i/)([A-Z0-9a-z]+)", - "url": "http://speedvideo.net/embed-\\1.html" + "url": "https://speedvideo.net/embed-\\1.html" } ] }, diff --git a/servers/streamingcommunity_server.json b/servers/streamingcommunity_server.json deleted file mode 100644 index ef7afc58..00000000 --- a/servers/streamingcommunity_server.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "https://streamingcommunity.net/[^/]+/([A-Za-z0-9]+)", - "url": "https://streamingcommunity.net/watch/\\1" - } - ] - }, - "free": true, - "id":"streamingcommunity_server", - "name": "StreamingCommunity", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@70708", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} diff --git a/servers/streamingcommunity_server.py b/servers/streamingcommunity_server.py deleted file mode 100644 index 4fa9acbd..00000000 --- a/servers/streamingcommunity_server.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -import requests, sys -from core import httptools, support -from platformcode import config, logger - -if sys.version_info[0] >= 3: from concurrent import futures -else: from concurrent_py2 import futures - -headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14', - 'content-type': 'application/json;charset=UTF-8', - 'Referer': 'https://streamingcommunity.net'} - -def test_video_exists(page_url): - global data - logger.debug('page url=', page_url) - response = httptools.downloadpage(page_url, headers=headers) - - if response.code == 404: - return False, config.get_localized_string(70449) % 'StreamingCommunity' - else: - data = response.data - return True, "" - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.debug("url=" + page_url) - video_urls = [] - url = support.match(data.replace('"','"').replace('\\',''), patron=r'video_url"\s*:\s*"([^"]+)"').match - def videourls(res): - newurl = '{}/{}'.format(url, res) - if requests.head(newurl, headers=headers).status_code == 200: - video_urls.append(["m3u8 {} [StreamingCommunity]".format(res), newurl]) - - with futures.ThreadPoolExecutor() as executor: - for res in ['480p', '720p', '1080p']: - executor.submit(videourls, res) - if not video_urls: video_urls = [["m3u8 [StreamingCommunity]", url]] - else: video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match)) - return video_urls diff --git a/servers/userload.py b/servers/userload.py index b8396349..df8fc879 100644 --- a/servers/userload.py +++ b/servers/userload.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import json +from lib import jsunpack from core import support, httptools from platformcode import logger, config @@ -19,9 +20,13 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= global data logger.debug("URL", page_url) video_urls = [] - var = support.match(data, patron=r"var\|\|([^']+)").match.split('|') + packed = support.match(data, patron=r"(eval\(function\(p,a,c,k,e,d\).*?)\s*<").match + unpack = jsunpack.unpack(packed) + var = support.match(unpack, patron= r'baffffbd="([^"]+)".*?edecbade="([^"]+)').match + if var: - post = 'morocco={}&mycountry={}'.format(var[7], var[17]) + post = 'morocco={}&mycountry={}'.format(var[1], var[0]) + logger.debug(post) url = support.match('https://userload.co/api/request/', post=post, patron=r'([^\s\r\n]+)').match if url: video_urls.append(["{} [Userload]".format(url.split('.')[-1]), url]) diff --git a/specials/globalsearch.py b/specials/globalsearch.py index 2605ba8a..3dad2a2b 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -25,6 +25,7 @@ def set_workers(): return workers def Search(*args): + xbmc.executebuiltin('Dialog.Close(all)') w = SearchWindow('GlobalSearch.xml', config.get_runtime_path()) w.start(*args) del w @@ -519,6 +520,7 @@ class SearchWindow(xbmcgui.WindowXML): elif action in [EXIT]: self.Close() close_action = True + xbmc.sleep(500) def onClick(self, control_id): global close_action @@ -698,7 +700,7 @@ class SearchWindow(xbmcgui.WindowXML): else: self.Focus(SEARCH) self.setFocusId(RESULTS) - self.RESULTS.selectItem(self.eppos) + self.RESULTS.selectItem(self.epos) elif self.EPISODES.isVisible(): self.episodes = [] self.Focus(SEARCH) @@ -717,6 +719,7 @@ class SearchWindow(xbmcgui.WindowXML): busy(False) self.close() + def context(self): focus = self.getFocusId() if focus == EPISODESLIST: # context on episode diff --git a/specials/setting.py b/specials/setting.py index ac4092ef..2f847944 100644 --- a/specials/setting.py +++ b/specials/setting.py @@ -241,7 +241,7 @@ def server_debrid_config(item): def servers_blacklist(item): server_list = servertools.get_servers_list() - black_list = config.get_setting("black_list", server='servers') + black_list = config.get_setting("black_list", server='servers', default=[]) blacklisted = [] list_controls = [] @@ -349,7 +349,7 @@ def cb_servers_favorites(server_names, dict_values): dict_favorites[dict_name[server_parameters['name']]] = server config.set_setting("favorites_servers_list", dict_name[server_parameters['name']], server=server) else: - config.set_setting("favorites_servers_list", 0, server=server) + config.set_setting("favorites_servers_list", 999, server=server) progreso.update(old_div((i * 100), n), config.get_localized_string(60559) % server_parameters['name']) i += 1 diff --git a/specials/tvmoviedb.py b/specials/tvmoviedb.py index 44714b4a..520e6d06 100644 --- a/specials/tvmoviedb.py +++ b/specials/tvmoviedb.py @@ -32,18 +32,18 @@ def mainlist(item): itemlist = [ # TMDB # item.clone(title=typo(config.get_localized_string(70021), 'bold'), action=""), - item.clone(title=typo(config.get_localized_string(70021) % (config.get_localized_string(30122), 'TMDB'), 'bold'), action="tmdb", args="movie", thumbnail=thumb('search_movie')), - item.clone(title=typo(config.get_localized_string(70021) % (config.get_localized_string(30123), 'TMDB'), 'bold'), action="tmdb", args="tv", thumbnail=thumb('search_tvshow')), + item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30122), 'TMDB'), action="tmdb", args="movie", thumbnail=thumb('search_movie')), + item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30123), 'TMDB'), action="tmdb", args="tv", thumbnail=thumb('search_tvshow')), # Filmaffinity # itemlist.append(item.clone(title=typo(config.get_localized_string(70024), 'bold'), action="")) # itemlist.append(item.clone(title=config.get_localized_string(70022), action="filmaf", args="movie", thumbnail=thumb('search_movie'))) # itemlist.append(item.clone(title=config.get_localized_string(70023), action="filmaf", args="tv", thumbnail=thumb('search_tvshow'))) # IMDB # item.clone(title=typo(config.get_localized_string(70025), 'bold'), action=""), - item.clone(title=typo(config.get_localized_string(70021) % (config.get_localized_string(30122), 'IMDB'), 'bold'), action="imdb", args="movie", url='&title_type=feature,tv_movie', thumbnail=thumb('search_movie')), - item.clone(title=typo(config.get_localized_string(70021) % (config.get_localized_string(30123), 'IMDB'), 'bold'), action="imdb", args="tv", url='&title_type=tv_series,tv_special,mini_series', thumbnail=thumb('search_tvshow')), - item.clone(title=typo(config.get_localized_string(70415), 'bold'), action="trakt", thumbnail="http://i.imgur.com/5sQjjuk.png"), - item.clone(title=typo(config.get_localized_string(70026), 'bold'), action="mal", thumbnail="http://i.imgur.com/RhsYWmd.png"), + item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30122), 'IMDB'), action="imdb", args="movie", url='&title_type=feature,tv_movie', thumbnail=thumb('search_movie')), + item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30123), 'IMDB'), action="imdb", args="tv", url='&title_type=tv_series,tv_special,mini_series', thumbnail=thumb('search_tvshow')), + item.clone(title=config.get_localized_string(70415), action="trakt", thumbnail="http://i.imgur.com/5sQjjuk.png"), + item.clone(title=config.get_localized_string(70026), action="mal", thumbnail="http://i.imgur.com/RhsYWmd.png"), item.clone(title=typo(config.get_localized_string(70027), 'color kod'), action="configuracion", folder=False) ] return itemlist @@ -130,8 +130,8 @@ def tmdb(item): itemlist.append(item.clone(title=config.get_localized_string(70036), action="search_", search={'url': 'search/person', 'language': langt, 'page': 1})) if item.args == "movie": itemlist.append(item.clone(title=config.get_localized_string(70037), action="search_", search={'url': "search/person", 'language': langt, 'page': 1}, crew=True)) - itemlist.append(item.clone(title=config.get_localized_string(70038), action="filter", )) - itemlist.append(item.clone(title=config.get_localized_string(70039), action="filter", )) + itemlist.append(item.clone(title=typo(config.get_localized_string(70038),'color kod'), action="filter", )) + itemlist.append(item.clone(title=typo(config.get_localized_string(70039),'color kod'), action="filter", )) return thumb(itemlist) @@ -155,7 +155,7 @@ def imdb(item): itemlist.append(item.clone(title=config.get_localized_string(30980), action="search_", url="http://www.imdb.com/search/title?title={}" + item.url)) itemlist.append(item.clone(title=config.get_localized_string(70036), action="search_", url="http://www.imdb.com/search/name?name={}")) - itemlist.append(item.clone(title=config.get_localized_string(70038), action="filter_imdb", )) + itemlist.append(item.clone(title=typo(config.get_localized_string(70038),'color kod'), action="filter_imdb", )) return thumb(itemlist) @@ -199,20 +199,20 @@ def trakt(item): page = "?page=1&limit=20&extended=full" if not item.args: item.args = "movie" - itemlist.append(item.clone(title=typo(config.get_localized_string(70416), 'bold'), action="")) - itemlist.append(item.clone(title=config.get_localized_string(70049), action="acciones_trakt", url="movies/popular%s" % page)) - itemlist.append(item.clone(title=config.get_localized_string(70050), action="acciones_trakt", url="movies/trending%s" % page)) - itemlist.append(item.clone(title=config.get_localized_string(70053), action="acciones_trakt", url="movies/watched/all%s" % page)) - itemlist.append(item.clone(title=config.get_localized_string(70051), action="acciones_trakt", url="movies/anticipated%s" % page)) - if token_auth: itemlist.append(item.clone(title=config.get_localized_string(70052), action="acciones_trakt",url="recommendations/movies?limit=100&extended=full", pagina=0)) - itemlist.append(item.clone(title=typo(config.get_localized_string(70417), 'bold'), action="",)) + # itemlist.append(item.clone(title=typo(config.get_localized_string(70416), 'bold'), action="")) + itemlist.append(item.clone(title=typo(config.get_localized_string(30122), 'bold') + typo(config.get_localized_string(70049),'[] _'), action="acciones_trakt", url="movies/popular%s" % page)) + itemlist.append(item.clone(title=typo(config.get_localized_string(30122), 'bold') + typo(config.get_localized_string(70050),'[] _'), action="acciones_trakt", url="movies/trending%s" % page)) + itemlist.append(item.clone(title=typo(config.get_localized_string(30122), 'bold') + typo(config.get_localized_string(70053),'[] _'), action="acciones_trakt", url="movies/watched/all%s" % page)) + itemlist.append(item.clone(title=typo(config.get_localized_string(30122), 'bold') + typo(config.get_localized_string(70051),'[] _'), action="acciones_trakt", url="movies/anticipated%s" % page)) + if token_auth: itemlist.append(item.clone(title=typo(config.get_localized_string(30122), 'bold') + typo(config.get_localized_string(70052),'[] _'), action="acciones_trakt",url="recommendations/movies?limit=100&extended=full", pagina=0)) + # itemlist.append(item.clone(title=typo(config.get_localized_string(70417), 'bold'), action="",)) item.args = "show" - itemlist.append(item.clone(title=config.get_localized_string(70049), action="acciones_trakt", url="shows/popular%s" % page)) - itemlist.append(item.clone(title=config.get_localized_string(70050), action="acciones_trakt", url="shows/trending%s" % page)) - itemlist.append(item.clone(title=config.get_localized_string(70053), action="acciones_trakt", url="shows/watched/all%s" % page)) - itemlist.append(item.clone(title=config.get_localized_string(70051), action="acciones_trakt", url="shows/anticipated%s" % page)) - if token_auth: itemlist.append(item.clone(title=config.get_localized_string(70052), action="acciones_trakt", url="recommendations/shows?limit=100&extended=full", pagina=0)) - itemlist.append(item.clone(title=typo(config.get_localized_string(70048), 'color kod bold'), args="cuenta")) + itemlist.append(item.clone(title=typo(config.get_localized_string(30123), 'bold') + typo(config.get_localized_string(70049),'[] _'), action="acciones_trakt", url="shows/popular%s" % page)) + itemlist.append(item.clone(title=typo(config.get_localized_string(30123), 'bold') + typo(config.get_localized_string(70050),'[] _'), action="acciones_trakt", url="shows/trending%s" % page)) + itemlist.append(item.clone(title=typo(config.get_localized_string(30123), 'bold') + typo(config.get_localized_string(70053),'[] _'), action="acciones_trakt", url="shows/watched/all%s" % page)) + itemlist.append(item.clone(title=typo(config.get_localized_string(30123), 'bold') + typo(config.get_localized_string(70051),'[] _'), action="acciones_trakt", url="shows/anticipated%s" % page)) + if token_auth: itemlist.append(item.clone(title=typo(config.get_localized_string(30123), 'bold') + typo(config.get_localized_string(70052),'[] _'), action="acciones_trakt", url="recommendations/shows?limit=100&extended=full", pagina=0)) + itemlist.append(item.clone(title=typo(config.get_localized_string(70048), 'color kod'), args="cuenta")) else: item.args = "movie" # A saved token is checked and the authentication process is executed @@ -220,16 +220,16 @@ def trakt(item): folder = (config.get_platform() == "plex") itemlist.append(item.clone(title=config.get_localized_string(70054), action="auth_trakt", folder=folder)) else: - itemlist.append(item.clone(title=config.get_localized_string(70055), action="", )) - itemlist.append(item.clone(title=config.get_localized_string(60651), action="acciones_trakt", url="users/me/watchlist/movies%s" % page, order="added", how="desc")) - itemlist.append(item.clone(title=config.get_localized_string(60652), action="acciones_trakt", url="users/me/watchlist/shows%s" % page, args="show", order="added", how="desc")) - itemlist.append(item.clone(title=config.get_localized_string(70056), action="", )) - itemlist.append(item.clone(title=config.get_localized_string(60651), action="acciones_trakt", url="users/me/watched/movies%s" % page, order="added", how="desc")) - itemlist.append(item.clone(title=config.get_localized_string(60652), action="acciones_trakt", url="users/me/watched/shows%s" % page, args="show", order="added", how="desc")) - itemlist.append(item.clone(title=config.get_localized_string(70068), action="", )) - itemlist.append(item.clone(title=config.get_localized_string(60651), action="acciones_trakt", url="users/me/collection/movies%s" % page, order="added", how="desc")) - itemlist.append(item.clone(title=config.get_localized_string(60652), action="acciones_trakt", url="users/me/collection/shows%s" % page, args="show", order="added", how="desc")) - itemlist.append(item.clone(title=config.get_localized_string(70057), action="acciones_trakt", url="users/me/lists", )) + + itemlist.append(item.clone(title=typo(config.get_localized_string(30122),'bold') + typo(config.get_localized_string(70055),'_ []'), action="acciones_trakt", url="users/me/watchlist/movies%s" % page, order="added", how="desc")) + itemlist.append(item.clone(title=typo(config.get_localized_string(30122),'bold') + typo(config.get_localized_string(70056),'_ []'), action="acciones_trakt", url="users/me/watched/movies%s" % page, order="added", how="desc")) + itemlist.append(item.clone(title=typo(config.get_localized_string(30122),'bold') + typo(config.get_localized_string(70068),'_ []'), action="acciones_trakt", url="users/me/collection/movies%s" % page, order="added", how="desc")) + + itemlist.append(item.clone(title=typo(config.get_localized_string(30123),'bold') + typo(config.get_localized_string(70055),'_ []'), action="acciones_trakt", url="users/me/watchlist/shows%s" % page, args="show", order="added", how="desc")) + itemlist.append(item.clone(title=typo(config.get_localized_string(30123),'bold') + typo(config.get_localized_string(70056),'_ []'), action="acciones_trakt", url="users/me/watched/shows%s" % page, args="show", order="added", how="desc")) + itemlist.append(item.clone(title=typo(config.get_localized_string(30123),'bold') + typo(config.get_localized_string(70068),'_ []'), action="acciones_trakt", url="users/me/collection/shows%s" % page, args="show", order="added", how="desc")) + + itemlist.append(item.clone(title=typo(config.get_localized_string(70057),'color kod bold'), action="acciones_trakt", url="users/me/lists", )) return itemlist @@ -249,9 +249,9 @@ def mal(item): itemlist.append(item.clone(title=config.get_localized_string(70063), url="", action="indices_mal")) if config.get_platform() != "plex": itemlist.append(item.clone(title=config.get_localized_string(70064), url="https://myanimelist.net/anime.php?q=", action="search_")) - itemlist.append(item.clone(title=typo(config.get_localized_string(70038), 'bold submenu'), action="filter_mal")) + itemlist.append(item.clone(title=typo(config.get_localized_string(70038), 'color kod'), action="filter_mal")) - itemlist.append(item.clone(title=typo(config.get_localized_string(70057), 'bold submenu'), action="cuenta_mal")) + itemlist.append(item.clone(title=typo(config.get_localized_string(70057), 'color kod'), action="cuenta_mal")) return itemlist @@ -267,15 +267,15 @@ def list_tmdb(item): # List of actors if 'nm' in item.infoLabels['imdb_id']: try: - ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_searching=langt) + ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_busqueda=langt) id_cast = ob_tmdb.result["person_results"][0]["id"] if item.contentType == "movie": item.search = {'url': 'discover/movie', 'with_cast': id_cast, 'page': item.pagina, 'sort_by': 'primary_release_date.desc', 'language': langt} else:item.search = {'url': 'person/%s/tv_credits' % id_cast, 'language': langt} - ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_searching=langt) + ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_busqueda=langt) except: pass else: - ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_searching=langt) + ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_busqueda=langt) # Sagas and collections if "collection" in item.search["url"]: @@ -307,7 +307,7 @@ def list_tmdb(item): new_item.infoLabels = ob_tmdb.get_infoLabels(new_item.infoLabels, origen=ob_tmdb.results[i]) # If there is no synopsis in the chosen language, search in the alternative if not new_item.infoLabels["plot"] and not 'person' in item.search["url"]: - ob_tmdb2 = Tmdb(id_Tmdb=new_item.infoLabels["tmdb_id"], tipo=item.args, idioma_searching=langt_alt) + ob_tmdb2 = Tmdb(id_Tmdb=new_item.infoLabels["tmdb_id"], tipo=item.args, idioma_busqueda=langt_alt) new_item.infoLabels["plot"] = ob_tmdb2.get_sinopsis() if new_item.infoLabels['thumbnail']: new_item.thumbnail = new_item.infoLabels['thumbnail'] @@ -375,10 +375,10 @@ def details(item): pics = match(data, patron=r'showAllVidsAndPics.*?href=".*?(tt\d+)').match if pics: images["imdb"] = {'url': 'http://www.imdb.com/_json/title/%s/mediaviewer' % pics} - ob_tmdb = Tmdb(external_id=item.infoLabels["imdb_id"], external_source="imdb_id", tipo=item.args, idioma_searching=langt) + ob_tmdb = Tmdb(external_id=item.infoLabels["imdb_id"], external_source="imdb_id", tipo=item.args, idioma_busqueda=langt) item.infoLabels["tmdb_id"] = ob_tmdb.get_id() - ob_tmdb = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo=item.args, idioma_searching=langt) + ob_tmdb = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo=item.args, idioma_busqueda=langt) try: item.infoLabels = ob_tmdb.get_infoLabels(item.infoLabels) @@ -407,24 +407,26 @@ def details(item): if item.infoLabels['tagline']: item.plot= typo(item.infoLabels['tagline'],'bold') + '\n' + item.plot title = item.contentType.replace("movie", config.get_localized_string(70283)).replace("tvshow", "serie") + # from core.support import dbg;dbg() + if not item.contentTitle: item.contentTitle = item.title.split('(')[0].strip() # Search by titles chosen language and / or original version and Spanish if config.get_setting('new_search'): - itemlist.append(item.clone(channel='globalsearch', action="Search", title=config.get_localized_string(70069) % (title, item.contentTitle), search_text=item.contentTitle, mode='search', type=item.contentType, folder=False)) + itemlist.append(item.clone(channel='globalsearch', action="Search", title=config.get_localized_string(70069) % (title, item.contentTitle), search_text=item.contentTitle, text=item.contentTitle, mode='search', type=item.contentType, folder=False)) if item.infoLabels['originaltitle'] and item.contentTitle != item.infoLabels['originaltitle']: itemlist.append(item.clone(channel='globalsearch', action="Search", search_text=item.infoLabels['originaltitle'], title=config.get_localized_string(70070) % item.infoLabels['originaltitle'], mode='search', type=item.contentType, folder=False)) else: - itemlist.append(item.clone(channel='search', action="new_search", title=config.get_localized_string(70069) % (title, item.contentTitle), search_text=item.contentTitle, mode=item.contentType)) + itemlist.append(item.clone(channel='search', action="new_search", title=config.get_localized_string(70069) % (title, item.contentTitle), search_text=item.contentTitle, text=item.contentTitle, mode=item.contentType)) if item.infoLabels['originaltitle'] and item.contentTitle != item.infoLabels['originaltitle']: itemlist.append(item.clone(channel='search', action="search", search_text=item.infoLabels['originaltitle'], title=config.get_localized_string(70070) % item.infoLabels['originaltitle'], mode=item.contentType)) # if langt != "es" and langt != "en" and item.infoLabels["tmdb_id"]: - # tmdb_lang = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo=item.args, idioma_searching=def_lang) + # tmdb_lang = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo=item.args, idioma_busqueda=def_lang) # if tmdb_lang.result.get("title") and tmdb_lang.result["title"] != item.contentTitle and tmdb_lang.result["title"] != item.infoLabels['originaltitle']: # tmdb_lang = tmdb_lang.result["title"] # itemlist.append(item.clone(channel='search', action="search", title=config.get_localized_string(70066) % tmdb_lang, contentTitle=tmdb_lang, mode=item.contentType)) # In case of series, option of info by seasons - if item.contentType == "tvshow" and item.infoLabels['tmdb_id']: + if item.contentType == "tvshow" and item.infoLabels['tmdb_id'] and "number_of_seasons" in item.infoLabels: itemlist.append(item.clone(action="info_seasons", title=config.get_localized_string(70067) % item.infoLabels["number_of_seasons"])) # Option to watch the cast and browse their movies / series if item.infoLabels['tmdb_id']: @@ -498,7 +500,7 @@ def distribution(item): itemlist = [] item.args=item.contentType.replace('tvshow','tv') item.search = {'url': '%s/%s/credits' % (item.args, item.infoLabels['tmdb_id'])} - ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_searching=langt) + ob_tmdb = Tmdb(discover=item.search, tipo=item.args, idioma_busqueda=langt) try: cast = ob_tmdb.result["cast"] @@ -543,9 +545,10 @@ def distribution(item): def info_seasons(item): # Season and episode info itemlist = [] - ob_tmdb = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo="tv", idioma_searching=langt) + ob_tmdb = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo="tv", idioma_busqueda=langt) + logger.info(item.infoLabels) - for temp in range(item.infoLabels["number_of_seasons"], 0, -1): + for temp in range(int(item.infoLabels["number_of_seasons"]), 0, -1): temporada = ob_tmdb.get_temporada(temp) if temporada: new_item = item.clone(action="", mediatype="season") @@ -855,11 +858,13 @@ def filter_imdb(item): data = match("http://www.imdb.com/search/title", cookies=False).data # bloque = scrapertools.find_single_match(data, '<h3>Genres</h3>(.*?)</table>') - matches = match(data, paronBlock=r'<h3>Genres</h3>(.*?)</table>', patron=r' value="([^"]+)"\s*>\s*<label.*?>([^<]+)<').matches + matches = match(data, patronBlock=r'<h3>Genres</h3>(.*?)</table>', patron=r' value="([^"]+)"\s*>\s*<label.*?>([^<]+)<').matches if matches: + list_controls.append({'id': 'espacio', 'label': '', 'enabled': False, 'type': 'label', 'default': None, 'visible': True}) list_controls.append({'id': 'labelgenre', 'enabled': True, 'type': 'label', 'visible': True, 'label': config.get_localized_string(70451),}) lista = [] for value, title in matches: + logger.debug('TITOLO:',title, genres_translate.get(title, title)) title = genres_translate.get(title, title) lista.append([value, title]) lista.sort(key=lambda lista: lista[1]) @@ -1213,18 +1218,18 @@ def indices_imdb(item): # if item.contentType == "movie": # ob_tmdb = Tmdb(text_buscado=item_tmdb.contentTitle, year=item_tmdb.infoLabels['year'], tipo=item_tmdb.args, -# idioma_searching=langt) +# idioma_busqueda=langt) # if not ob_tmdb.result: # ob_tmdb = Tmdb(text_buscado=item_tmdb.infoLabels['originaltitle'], year=item_tmdb.infoLabels['year'], -# tipo=item_tmdb.args, idioma_searching=langt) +# tipo=item_tmdb.args, idioma_busqueda=langt) # else: -# ob_tmdb = Tmdb(text_buscado=item_tmdb.contentTitle, tipo=item_tmdb.args, idioma_searching=langt) +# ob_tmdb = Tmdb(text_buscado=item_tmdb.contentTitle, tipo=item_tmdb.args, idioma_busqueda=langt) # if not ob_tmdb.result: # ob_tmdb = Tmdb(text_buscado=item_tmdb.infoLabels['tvshowtitle'], tipo=item_tmdb.args, -# idioma_searching=langt) +# idioma_busqueda=langt) # if ob_tmdb.result: -# ob_tmdb = Tmdb(id_Tmdb=ob_tmdb.get_id(), tipo=item_tmdb.args, idioma_searching=langt) +# ob_tmdb = Tmdb(id_Tmdb=ob_tmdb.get_id(), tipo=item_tmdb.args, idioma_busqueda=langt) # item.infoLabels = ob_tmdb.get_infoLabels(item.infoLabels) # # If there is no synopsis in the chosen language, search in the alternative @@ -1284,7 +1289,7 @@ def indices_imdb(item): # title=config.get_localized_string(70070) % item.infoLabels['originaltitle'])) # if langt != "es" and langt != "en" and item.infoLabels["tmdb_id"]: -# tmdb_lang = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo=item.args, idioma_searching=def_lang) +# tmdb_lang = Tmdb(id_Tmdb=item.infoLabels["tmdb_id"], tipo=item.args, idioma_busqueda=def_lang) # if tmdb_lang.result.get("title") and tmdb_lang.result["title"] != item.contentTitle: # tmdb_lang = tmdb_lang.result["title"] # itemlist.append(item.clone(action="searching", title=config.get_localized_string(70066) % tmdb_lang, @@ -1833,7 +1838,7 @@ def fanartv(item): id_search = item.infoLabels['tmdb_id'] if item.contentType == "tvshow" and id_search: search = {'url': 'tv/%s/external_ids' % item.infoLabels['tmdb_id'], 'language': langt} - ob_tmdb = Tmdb(discover=search, idioma_searching=langt) + ob_tmdb = Tmdb(discover=search, idioma_busqueda=langt) id_search = ob_tmdb.result.get("tvdb_id") resultado = False @@ -1991,7 +1996,7 @@ def acciones_trakt(item): data = jsontools.load(data) for entry in data: new_item = item.clone() - new_item.title = entry["name"] + ' ' + entry["item_count"] + new_item.title = typo(entry["name"],'bold') + typo(str(entry["item_count"]),'color kod bold _ []') new_item.infoLabels["plot"] = entry.get("description") new_item.url = "users/me/lists/%s/items/?page=1&limit=20&extended=full" % entry["ids"]["trakt"] new_item.order = entry.get("sort_by") @@ -2111,25 +2116,25 @@ def details_mal(item): item_tmdb = item.clone() if item.contentType == "movie": - ob_tmdb = Tmdb(text_buscado=item_tmdb.contentTitle, year=item_tmdb.infoLabels['year'], tipo=item_tmdb.args, idioma_searching=langt) + ob_tmdb = Tmdb(text_buscado=item_tmdb.contentTitle, year=item_tmdb.infoLabels['year'], tipo=item_tmdb.args, idioma_busqueda=langt) if not ob_tmdb.result and eng_title: - ob_tmdb = Tmdb(text_buscado=eng_title, year=item_tmdb.infoLabels['year'], tipo=item_tmdb.args, idioma_searching=langt) + ob_tmdb = Tmdb(text_buscado=eng_title, year=item_tmdb.infoLabels['year'], tipo=item_tmdb.args, idioma_busqueda=langt) if not ob_tmdb.result and ("Special (" in item.title or item.tipo == "special"): item_tmdb.args = "tv" search = {'url': 'search/tv', 'language': langt, 'query': item_tmdb.contentTitle, 'first_air_date': item_tmdb.infoLabels["year"]} - ob_tmdb = Tmdb(discover=search, tipo=item_tmdb.args, idioma_searching=langt) + ob_tmdb = Tmdb(discover=search, tipo=item_tmdb.args, idioma_busqueda=langt) else: search = {'url': 'search/tv', 'language': langt, 'query': eng_title, 'first_air_date': item_tmdb.infoLabels["year"]} - ob_tmdb = Tmdb(discover=search, tipo=item_tmdb.args, idioma_searching=langt) + ob_tmdb = Tmdb(discover=search, tipo=item_tmdb.args, idioma_busqueda=langt) if not ob_tmdb.result and eng_title: search['query'] = eng_title - ob_tmdb = Tmdb(discover=search, tipo=item_tmdb.args, idioma_searching=langt) + ob_tmdb = Tmdb(discover=search, tipo=item_tmdb.args, idioma_busqueda=langt) if not ob_tmdb.result and ("OVA (" in item.title or item.tipo == "ova"): item_tmdb.args = "movie" - ob_tmdb = Tmdb(text_buscado=item_tmdb.contentTitle, tipo=item_tmdb.args, idioma_searching=langt, year=item_tmdb.infoLabels['year']) + ob_tmdb = Tmdb(text_buscado=item_tmdb.contentTitle, tipo=item_tmdb.args, idioma_busqueda=langt, year=item_tmdb.infoLabels['year']) if ob_tmdb.result: - ob_tmdb = Tmdb(id_Tmdb=ob_tmdb.get_id(), tipo=item_tmdb.args, idioma_searching=langt) + ob_tmdb = Tmdb(id_Tmdb=ob_tmdb.get_id(), tipo=item_tmdb.args, idioma_busqueda=langt) item.infoLabels = ob_tmdb.get_infoLabels(item.infoLabels) # Myanimelist synopsis is concatenated with that of tmdb if any @@ -2175,7 +2180,7 @@ def details_mal(item): if eng_title and item.contentTitle != eng_title and title_mal != eng_title: itemlist.append(item.clone(action="new_search", channel='search', search_text=eng_title, title=config.get_localized_string(70352) % eng_title, thumbnail=thumb('search'))) - if item_tmdb.args == "tv" and ob_tmdb.result: + if item_tmdb.args == "tv" and ob_tmdb.result and "number_of_seasons" in item.infoLabels: itemlist.append(item.clone(action="info_seasons", title=config.get_localized_string(70067) % item.infoLabels["number_of_seasons"], thumbnail=thumb('info'))) itemlist.append(item.clone(action="videos_mal", title=config.get_localized_string(70353), url=item.url + "/video", thumbnail=thumb('trailer'))) diff --git a/specials/videolibrary.py b/specials/videolibrary.py index 115cb460..21ff24eb 100644 --- a/specials/videolibrary.py +++ b/specials/videolibrary.py @@ -87,8 +87,6 @@ def list_tvshows(item): def get_results(nfo_path, root, Type, local=False): - dead_list = [] - zombie_list = [] value = 0 if Type == 'movie': folder = "folder_movies" else: folder = "folder_tvshows" @@ -107,40 +105,6 @@ def get_results(nfo_path, root, Type, local=False): if len(item.library_urls) > 1: multichannel = True else: multichannel = False - # Verify the existence of the channels. If the channel does not exist, ask yourself if you want to remove the links from that channel. - - for canal in item.library_urls: - try: - if canal in ['community', 'downloads']: channel_verify = __import__('specials.%s' % canal, fromlist=["channels.%s" % canal]) - else: channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal]) - logger.debug('Channel %s seems correct' % channel_verify) - except: - dead_item = Item(multichannel=multichannel, - contentType='tvshow', - dead=canal, - path=filetools.split(nfo_path)[0], - nfo=nfo_path, - library_urls=item.library_urls, - infoLabels={'title': item.contentTitle}) - - if canal not in dead_list and canal not in zombie_list: confirm = platformtools.dialog_yesno(config.get_localized_string(30131), config.get_localized_string(30132) % canal.upper() + '\n' + config.get_localized_string(30133)) - elif canal in zombie_list: confirm = False - else: confirm = True - - if confirm: - delete(dead_item) - if canal not in dead_list: - dead_list.append(canal) - continue - else: - if canal not in zombie_list: - zombie_list.append(canal) - - if len(dead_list) > 0: - for canal in dead_list: - if canal in item.library_urls: - del item.library_urls[canal] - # continue loading the elements of the video library if Type == 'movie': item.path = filetools.split(nfo_path)[0] @@ -377,6 +341,8 @@ def get_episodes(item): def findvideos(item): from core import autoplay + from platformcode import platformtools + logger.debug() # logger.debug("item:\n" + item.tostring('\n')) videolibrarytools.check_renumber_options(item) @@ -436,7 +402,6 @@ def findvideos(item): if item_local: opciones.append(item_local.title) - from platformcode import platformtools index = platformtools.dialog_select(config.get_localized_string(30163), opciones) if index < 0: return [] @@ -449,6 +414,7 @@ def findvideos(item): filtro_canal = opciones[index].replace(config.get_localized_string(70078), "").strip() itemlist = [] + all_videolibrary = [] for nom_canal, json_path in list(list_canales.items()): if filtro_canal and filtro_canal != nom_canal.capitalize(): continue @@ -463,6 +429,50 @@ def findvideos(item): channel = __import__('channels.%s' % nom_canal, fromlist=["channels.%s" % nom_canal]) except ImportError: exec("import channels." + nom_canal + " as channel") + except: + dead_list = [] + zombie_list = [] + + if nom_canal not in dead_list and nom_canal not in zombie_list: confirm = platformtools.dialog_yesno(config.get_localized_string(30131), config.get_localized_string(30132) % nom_canal.upper() + '\n' + config.get_localized_string(30133)) + elif nom_canal in zombie_list: confirm = False + else: confirm = True + + if confirm: + # delete the channel from all movie and tvshow + from past.utils import old_div + num_enlaces = 0 + dialog = platformtools.dialog_progress(config.get_localized_string(30131), config.get_localized_string(60005) % nom_canal) + if not all_videolibrary: + all_videolibrary = list_movies(Item()) + list_tvshows(Item()) + for n, it in enumerate(all_videolibrary): + if nom_canal in it.library_urls: + dead_item = Item(multichannel=len(it.library_urls) > 1, + contentType=it.contentType, + dead=nom_canal, + path=filetools.split(it.nfo)[0], + nfo=it.nfo, + library_urls=it.library_urls, + infoLabels={'title': it.contentTitle}) + num_enlaces += delete(dead_item) + dialog.update(old_div(100*n, len(all_videolibrary))) + + dialog.close() + msg_txt = config.get_localized_string(70087) % (num_enlaces, nom_canal) + logger.info(msg_txt) + platformtools.dialog_notification(config.get_localized_string(30131), msg_txt) + platformtools.itemlist_refresh() + + if nom_canal not in dead_list: + dead_list.append(nom_canal) + continue + else: + if nom_canal not in zombie_list: + zombie_list.append(nom_canal) + + if len(dead_list) > 0: + for nom_canal in dead_list: + if nom_canal in item.library_urls: + del item.library_urls[nom_canal] item_json = Item().fromjson(filetools.read(json_path)) list_servers = [] @@ -1048,15 +1058,13 @@ def delete(item): if item_nfo.emergency_urls and item_nfo.emergency_urls.get(canal, False): del item_nfo.emergency_urls[canal] filetools.write(item.nfo, head_nfo + item_nfo.tojson()) - - msg_txt = config.get_localized_string(70087) % (num_enlaces, canal) - logger.info(msg_txt) - platformtools.dialog_notification(heading, msg_txt) - platformtools.itemlist_refresh() - + return num_enlaces else: if platformtools.dialog_yesno(heading, config.get_localized_string(70088) % item.infoLabels['title']): delete_all(item) + return 1 + else: + return 0 def check_season_playcount(item, season): diff --git a/tests/test_generic.py b/tests/test_generic.py index bc39d682..aa6a28f1 100644 --- a/tests/test_generic.py +++ b/tests/test_generic.py @@ -62,6 +62,7 @@ validUrlRegex = re.compile( r'(?:/?|[/?]\S+)$', re.IGNORECASE) chBlackList = ['url', 'mediasetplay'] +srvBlacklist = ['mega', 'hdmario', 'torrent', 'youtube'] chNumRis = { 'altadefinizione01': { 'Film': 20 @@ -141,8 +142,7 @@ chNumRis = { servers = [] channels = [] -# channel_list = channelselector.filterchannels("all") if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")] -channel_list = [Item(channel='tantifilm', action="mainlist")] +channel_list = channelselector.filterchannels("all") if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")] logger.info([c.channel for c in channel_list]) ret = [] @@ -198,8 +198,10 @@ for chItem in channel_list: if itPlay: tmp.append(itPlay[0]) serversFound[it.title] = tmp - servers.extend( - {'name': srv.server.lower(), 'server': srv} for srv in serversFound[it.title] if srv.server) + for srv in serversFound[it.title]: + if srv.server: + srv.foundOn = ch + ' --> ' + it.title + ' --> ' + resIt.title + servers.append({'name': srv.server.lower(), 'server': srv}) break except: import traceback @@ -220,7 +222,7 @@ print(channels) serverNames = [] serversFinal = [] for s in servers: - if not s['name'] in serverNames: + if s['name'] not in serverNames and s['name'] not in srvBlacklist: serverNames.append(s['name']) serversFinal.append(s) @@ -304,6 +306,9 @@ class GenericServerTest(unittest.TestCase): module = __import__('servers.%s' % self.name, fromlist=["servers.%s" % self.name]) page_url = self.server.url print('testing ' + page_url) + print('Found on ' + self.server.foundOn) + print() + self.assert_(hasattr(module, 'test_video_exists'), self.name + ' has no test_video_exists') if module.test_video_exists(page_url)[0]: @@ -327,7 +332,10 @@ class GenericServerTest(unittest.TestCase): print(headers) if 'magnet:?' in directUrl: # check of magnet links not supported continue - page = downloadpage(directUrl, headers=headers, only_headers=True, use_requests=True, verify=False) + if directUrl.split('.')[-1] == 'm3u8': # m3u8 is a text file and HEAD may be forbidden + page = downloadpage(directUrl, headers=headers, use_requests=True, verify=False) + else: + page = downloadpage(directUrl, headers=headers, only_headers=True, use_requests=True, verify=False) self.assertTrue(page.success, self.name + ' scraper returned an invalid link') self.assertLess(page.code, 400, self.name + ' scraper returned a ' + str(page.code) + ' link') contentType = page.headers['Content-Type']