From 58084388e6083f738287b8b93bfe7e7248ca5483 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Mon, 29 Mar 2021 17:01:22 +0200 Subject: [PATCH] Migliorata funzione "cerca trailer" --- channels/filmpertutti.py | 1 - platformcode/platformtools.py | 4 ++-- specials/trailertools.py | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/channels/filmpertutti.py b/channels/filmpertutti.py index e9f24e30..37cc584f 100644 --- a/channels/filmpertutti.py +++ b/channels/filmpertutti.py @@ -115,7 +115,6 @@ def select(item): def search(item, texto): support.info() item.url = host + "/?s=" + texto - item.contentType = 'episode' item.args = 'search' try: return peliculas(item) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 9039cb74..e8be7e2a 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -936,8 +936,8 @@ def get_dialogo_opciones(item, default_action, strm, autoplay): if default_action == 3: seleccion = len(opciones) - 1 - # Search for trailers on youtube - if item.channel not in ["Trailer", "ecarteleratrailers"]: + # Search for trailers + if item.channel not in ["trailertools"]: # "Search Trailer" opciones.append(config.get_localized_string(30162)) diff --git a/specials/trailertools.py b/specials/trailertools.py index 1bbc7630..29ef108a 100644 --- a/specials/trailertools.py +++ b/specials/trailertools.py @@ -48,8 +48,7 @@ else: def buscartrailer(item, trailers=[]): logger.debug() - - if item.show or item.infoLabels['tvshowtitle'] or item.contentType != "movie": + if item.contentType != "movie": tipo = "tv" else: tipo = "movie" @@ -113,7 +112,7 @@ def buscartrailer(item, trailers=[]): action="", thumbnail=get_thumb('nofolder.png'), text_color="")) from lib.fuzzy_match import algorithims - itemlist.sort(key=lambda r: algorithims.trigram(item.contentTitle, r.title), reverse=True) + itemlist.sort(key=lambda r: algorithims.trigram(item.contentTitle + ' trailer', r.title), reverse=True) if item.contextual: global window_select, result @@ -162,8 +161,8 @@ def tmdb_trailers(item, tipo="movie"): for vid in tmdb_search.get_videos(): found = False if vid['type'].lower() == 'trailer': - title = vid['name'] + " [" + vid['size'] + "p]" - it = item.clone(action="play", title=title, title2="TMDB(youtube) - LANG:" + vid['language'].replace("en", "ING").replace("it", "ITA"), url=vid['url'], server="youtube") + title = vid['name'] + it = item.clone(action="play", title=title, title2="TMDB(youtube) - " + vid['language'].replace("en", "ING").replace("it", "ITA") + " [" + vid['size'] + "p]", url=vid['url'], server="youtube") itemlist.append(it) if vid['language'] == def_lang and not found: # play now because lang is correct and TMDB is trusted @@ -215,7 +214,10 @@ def mymovies_search(item): title = item.contentTitle url = 'https://www.mymovies.it/ricerca/ricerca.php?limit=true&q=' + title - js = json.loads(httptools.downloadpage(url).data)['risultati']['film']['elenco'] + try: + js = json.loads(httptools.downloadpage(url).data)['risultati']['film']['elenco'] + except: + return [] itemlist = [] with futures.ThreadPoolExecutor() as executor: @@ -230,9 +232,11 @@ def mymovies_search(item): def search_links_mymovies(item): global result logger.debug() - trailer_url = match(item, patron=r'