From 9813a4d54b42193360b64c6fd08e47082d176136 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Tue, 31 Jul 2018 13:12:17 +0200 Subject: [PATCH 1/8] =?UTF-8?q?B=C3=BAsquedas:=20mejoras?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Se adapta al nuevo tipo de búsquedas --- plugin.video.alfa/channels/alltorrent.py | 17 +++++++++-- plugin.video.alfa/channels/elitetorrent.py | 17 +++++++++-- plugin.video.alfa/channels/grantorrent.py | 7 +++-- plugin.video.alfa/channels/mejortorrent1.py | 18 +++++++++--- plugin.video.alfa/channels/newpct1.py | 31 +++++++++++++-------- 5 files changed, 67 insertions(+), 23 deletions(-) diff --git a/plugin.video.alfa/channels/alltorrent.py b/plugin.video.alfa/channels/alltorrent.py index d982c347..aa761c32 100755 --- a/plugin.video.alfa/channels/alltorrent.py +++ b/plugin.video.alfa/channels/alltorrent.py @@ -126,6 +126,7 @@ def listado(item): title = title.replace("Dual", "").replace("dual", "").replace("Subtitulada", "").replace("subtitulada", "").replace("Subt", "").replace("subt", "").replace("Sub", "").replace("sub", "").replace("(Proper)", "").replace("(proper)", "").replace("Proper", "").replace("proper", "").replace("#", "").replace("(Latino)", "").replace("Latino", "") title = title.replace("- HDRip", "").replace("(HDRip)", "").replace("- Hdrip", "").replace("(microHD)", "").replace("(DVDRip)", "").replace("(HDRip)", "").replace("(BR-LINE)", "").replace("(HDTS-SCREENER)", "").replace("(BDRip)", "").replace("(BR-Screener)", "").replace("(DVDScreener)", "").replace("TS-Screener", "").replace(" TS", "").replace(" Ts", "") title = re.sub(r'\??\s?\d*?\&.*', '', title).title().strip() + item_local.from_title = title #Guardamos esta etiqueta para posible desambiguación de título item_local.contentType = "movie" item_local.contentTitle = title @@ -139,8 +140,8 @@ def listado(item): itemlist.append(item_local.clone()) #Pintar pantalla - if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global - return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo + #if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global + # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo #Pasamos a TMDB la lista completa Itemlist tmdb.set_infoLabels(itemlist, True) @@ -264,7 +265,19 @@ def findvideos(item): return itemlist + +def actualizar_titulos(item): + logger.info() + itemlist = [] + + from platformcode import launcher + + item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels + + #Volvemos a la siguiente acción en el canal + return item + def search(item, texto): logger.info() texto = texto.replace(" ", "+") diff --git a/plugin.video.alfa/channels/elitetorrent.py b/plugin.video.alfa/channels/elitetorrent.py index 224e94a6..86a1930d 100644 --- a/plugin.video.alfa/channels/elitetorrent.py +++ b/plugin.video.alfa/channels/elitetorrent.py @@ -173,6 +173,7 @@ def listado(item): title = title.replace("Dual", "").replace("dual", "").replace("Subtitulada", "").replace("subtitulada", "").replace("Subt", "").replace("subt", "").replace("Sub", "").replace("sub", "").replace("(Proper)", "").replace("(proper)", "").replace("Proper", "").replace("proper", "").replace("#", "").replace("(Latino)", "").replace("Latino", "") title = title.replace("- HDRip", "").replace("(HDRip)", "").replace("- Hdrip", "").replace("(microHD)", "").replace("(DVDRip)", "").replace("(HDRip)", "").replace("(BR-LINE)", "").replace("(HDTS-SCREENER)", "").replace("(BDRip)", "").replace("(BR-Screener)", "").replace("(DVDScreener)", "").replace("TS-Screener", "").replace(" TS", "").replace(" Ts", "") title = re.sub(r'\??\s?\d*?\&.*', '', title).title().strip() + item_local.from_title = title #Guardamos esta etiqueta para posible desambiguación de título if item_local.extra == "peliculas": #preparamos Item para películas if "/serie" in scrapedurl or "/serie" in item.url: @@ -215,8 +216,8 @@ def listado(item): itemlist.append(item_local.clone()) #Pintar pantalla - if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global - return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo + #if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global + # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo #Pasamos a TMDB la lista completa Itemlist tmdb.set_infoLabels(itemlist, True) @@ -339,6 +340,18 @@ def findvideos(item): return itemlist +def actualizar_titulos(item): + logger.info() + itemlist = [] + + from platformcode import launcher + + item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels + + #Volvemos a la siguiente acción en el canal + return item + + def search(item, texto): logger.info("search:" + texto) # texto = texto.replace(" ", "+") diff --git a/plugin.video.alfa/channels/grantorrent.py b/plugin.video.alfa/channels/grantorrent.py index 27ed4ee5..cfa78a18 100644 --- a/plugin.video.alfa/channels/grantorrent.py +++ b/plugin.video.alfa/channels/grantorrent.py @@ -333,13 +333,14 @@ def listado(item): item_local.contentSerieName = title.strip() item_local.title = title.strip() #Salvamos el título + item_local.from_title = title.strip() #Guardamos esta etiqueta para posible desambiguación de título item_local.infoLabels['year'] = "-" #Reseteamos el año para que TMDB nos lo de #Agrega el item local a la lista itemlist itemlist.append(item_local.clone()) - if not item.category and result_mode == 0: #Si este campo no existe, viene de la primera pasada de una búsqueda global - return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorrar tiempo + #if not item.category and result_mode == 0: #Si este campo no existe, viene de la primera pasada de una búsqueda global + # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorrar tiempo #Pasamos a TMDB la lista completa Itemlist tmdb.set_infoLabels(itemlist, __modo_grafico__) @@ -820,7 +821,7 @@ def actualizar_titulos(item): item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels #Volvemos a la siguiente acción en el canal - return launcher.run(item) + return item def search(item, texto): diff --git a/plugin.video.alfa/channels/mejortorrent1.py b/plugin.video.alfa/channels/mejortorrent1.py index 1b746fa8..33d7a0c1 100644 --- a/plugin.video.alfa/channels/mejortorrent1.py +++ b/plugin.video.alfa/channels/mejortorrent1.py @@ -340,7 +340,15 @@ def listado(item): item_local.url = url item_local.contentType = "season" else: - real_title, item_local.contentSeason, item_local.quality = scrapertools.find_single_match(scrapedurl, patron_title_se) + try: + real_title, item_local.contentSeason, item_local.quality = scrapertools.find_single_match(scrapedurl, patron_title_se) + except: + real_title = '' + item_local.action = "findvideos" + item_local.contentType = "episode" + item_local.contentSeason = 1 + item_local.contentEpisodeNumber = 1 + item_local.quality = '' item_local.contentSerieName = real_title.replace("-", " ").capitalize() if not item_local.contentSeason: @@ -448,6 +456,7 @@ def listado(item): elif item_local.contentType != "episode": item_local.title = title item_local.title = item_local.contentSerieName + item_local.from_title = title #Guardamos esta etiqueta para posible desambiguación de título if "saga" in item_local.contentTitle.lower() or "saga" in item_local.contentSerieName.lower(): item_local.contentTitle = item_local.contentTitle.replace("Saga ", "").replace("Saga", "") @@ -681,6 +690,7 @@ def listado_busqueda(item): title = title.replace("4k-hdr", "").replace("4K-HDR", "").replace("hdr", "").replace("HDR", "").replace("4k", "").replace("4K", "") title = title.replace("(", "").replace(")", "").replace("[", "").replace("]", "").strip() item_local.title = title + item_local.from_title = title #Guardamos esta etiqueta para posible desambiguación de título if "Peliculas" in scrapedtype or "Variados" in scrapedtype: item_local.action = "findvideos" @@ -711,8 +721,8 @@ def listado_busqueda(item): #logger.debug(item_local) - if not category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global - return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo + #if not category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global + # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo #Llamamos a TMDB para que complete InfoLabels desde itemlist. Mejor desde itemlist porque envía las queries en paralelo tmdb.set_infoLabels(itemlist, __modo_grafico__) @@ -973,7 +983,7 @@ def actualizar_titulos(item): item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels #Volvemos a la siguiente acción en el canal - return launcher.run(item) + return item def search(item, texto): diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index 89a6f77e..2d14a510 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -405,8 +405,8 @@ def listado(item): itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - #logger.debug("MATCHES: " + str(len(matches))) - #logger.debug(matches) + logger.debug("MATCHES: " + str(len(matches))) + logger.debug(matches) #logger.debug("patron: " + patron + " / fichas: " + fichas) # Identifico la página actual y el total de páginas para el pie de página @@ -476,7 +476,9 @@ def listado(item): # Limpiamos títulos, Sacamos datos de calidad, audio y lenguaje title = re.sub('\r\n', '', scrapedtitle).decode('iso-8859-1').encode('utf8').strip() + #title = re.sub('\r\n', '', scrapedtitle).decode('utf-8').encode('utf-8').strip() title_alt = re.sub('\r\n', '', scrapedtitle_alt).decode('iso-8859-1').encode('utf8').strip() + #title_alt = re.sub('\r\n', '', scrapedtitle_alt).decode('utf-8').encode('utf-8').strip() title = title.replace("á", "a").replace("é", "e").replace("í", "i").replace("ó", "o").replace("ú", "u").replace("ü", "u").replace("�", "ñ").replace("ñ", "ñ").replace(".", " ") title_alt = title_alt.replace("á", "a").replace("é", "e").replace("í", "i").replace("ó", "o").replace("ú", "u").replace("ü", "u").replace("�", "ñ").replace("ñ", "ñ") @@ -485,7 +487,7 @@ def listado(item): #Determinamos y marcamos idiomas distintos del castellano item_local.language = [] - if "[vos" in title.lower() or "v.o.s" in title.lower() or "vo" in title.lower() or ".com/pelicula/" in scrapedurl or ".com/series-vo" in scrapedurl or "-vo/" in scrapedurl or "vos" in calidad.lower() or "vose" in calidad.lower() or "v.o.s" in calidad.lower() or "sub" in calidad.lower() or ".com/peliculas-vo" in item.url: + if "[vos" in title.lower() or "v.o.s" in title.lower() or "vo" in title.lower() or "subs" in title.lower() or ".com/pelicula/" in scrapedurl or ".com/series-vo" in scrapedurl or "-vo/" in scrapedurl or "vos" in calidad.lower() or "vose" in calidad.lower() or "v.o.s" in calidad.lower() or "sub" in calidad.lower() or ".com/peliculas-vo" in item.url: item_local.language += ["VOS"] title = title.replace(" [Subs. integrados]", "").replace(" [subs. Integrados]", "").replace(" [VOSE", "").replace(" [VOS", "").replace(" (V.O.S.E)", "").replace(" VO", "").replace("Subtitulos", "") if "latino" in title.lower() or "argentina" in title.lower() or "-latino/" in scrapedurl or "latino" in calidad.lower() or "argentina" in calidad.lower(): @@ -557,9 +559,9 @@ def listado(item): title = re.sub(r' \d+x\d+', '', title) title = re.sub(r' x\d+', '', title) - title = title.replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("HD ", "").replace("(Proper)", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("(", "-").replace(")", "-").replace(".", " ").strip() + title = title.replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("HD ", "").replace("(Proper)", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("(", "-").replace(")", "-").replace(".", " ").strip() - title = title.replace("Descargar torrent ", "").replace("Descarga Gratis ", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").strip() + title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").strip() if title.endswith("torrent gratis"): title = title[:-15] if title.endswith("gratis"): title = title[:-7] @@ -586,6 +588,7 @@ def listado(item): #Limpieza final del título y guardado en las variables según su tipo de contenido title = scrapertools.remove_htmltags(title) item_local.title = title + item_local.from_title = title #Guardamos esta etiqueta para posible desambiguación de título if item_local.contentType == "movie": item_local.contentTitle = title else: @@ -609,6 +612,8 @@ def listado(item): #Agrega el item local a la lista itemlist itemlist.append(item_local.clone()) + + #logger.debug(item_local) #Pasamos a TMDB la lista completa Itemlist tmdb.set_infoLabels(itemlist, __modo_grafico__) @@ -920,13 +925,14 @@ def listado_busqueda(item): # Limpiamos títulos, Sacamos datos de calidad, audio y lenguaje title = re.sub('\r\n', '', scrapedtitle).decode('iso-8859-1').encode('utf8').strip() + #title = re.sub('\r\n', '', scrapedtitle).decode('utf-8').encode('utf-8').strip() title = title.replace("á", "a").replace("é", "e").replace("í", "i").replace("ó", "o").replace("ú", "u").replace("ü", "u").replace("�", "ñ").replace("ñ", "ñ") item_local.quality = scrapertools.htmlclean(calidad) #Determinamos y marcamos idiomas distintos del castellano item_local.language = [] - if "[vos" in title.lower() or "v.o.s" in title.lower() or "vo" in title.lower() or ".com/pelicula/" in url or ".com/series-vo" in url or "-vo/" in url or "vos" in calidad.lower() or "vose" in calidad.lower() or "v.o.s" in calidad.lower() or "sub" in calidad.lower() or ".com/peliculas-vo" in item.url: + if "[vos" in title.lower() or "v.o.s" in title.lower() or "vo" in title.lower() or "subs" in title.lower() or ".com/pelicula/" in url or ".com/series-vo" in url or "-vo/" in url or "vos" in calidad.lower() or "vose" in calidad.lower() or "v.o.s" in calidad.lower() or "sub" in calidad.lower() or ".com/peliculas-vo" in item.url: item_local.language += ["VOS"] title = title.replace(" [Subs. integrados]", "").replace(" [subs. Integrados]", "").replace(" [VOSE", "").replace(" [VOS", "").replace(" (V.O.S.E)", "").replace(" VO", "").replace("Subtitulos", "") if "latino" in title.lower() or "argentina" in title.lower() or "-latino/" in url or "latino" in calidad.lower() or "argentina" in calidad.lower(): @@ -986,7 +992,7 @@ def listado_busqueda(item): title_subs += ["[Miniserie]"] #Limpiamos restos en título - title = title.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Ing", "").replace("Eng", "").replace("Calidad", "").replace("de la Serie", "") + title = title.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Ingl", "").replace("Engl", "").replace("Calidad", "").replace("de la Serie", "") #Limpiamos cabeceras y colas del título title = re.sub(r'Descargar\s\w+\-\w+', '', title) @@ -996,9 +1002,9 @@ def listado_busqueda(item): title = re.sub(r' \d+x\d+', '', title) title = re.sub(r' x\d+', '', title) - title = title.replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("HD ", "").replace("(Proper)", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("(", "-").replace(")", "-").replace(".", " ").strip() + title = title.replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("HD ", "").replace("(Proper)", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("(", "-").replace(")", "-").replace(".", " ").strip() - title = title.replace("Descargar torrent ", "").replace("Descarga Gratis ", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").strip() + title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").strip() if "pelisyseries.com" in host and item_local.contentType == "tvshow": titulo = '' @@ -1045,6 +1051,7 @@ def listado_busqueda(item): #Limpieza final del título y guardado en las variables según su tipo de contenido item_local.title = title + item_local.from_title = title #Guardamos esta etiqueta para posible desambiguación de título if item_local.contentType == "movie": item_local.contentTitle = title size = scrapedsize.replace(".", ",") @@ -1126,8 +1133,8 @@ def listado_busqueda(item): #Agrega el item local a la lista itemlist itemlist.append(item_local.clone()) - if not item.category_new: #Si este campo no existe es que viene de la primera pasada de una búsqueda global - return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo + #if not item.category_new: #Si este campo no existe es que viene de la primera pasada de una búsqueda global + # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo #Pasamos a TMDB la lista completa Itemlist tmdb.set_infoLabels(itemlist, __modo_grafico__) @@ -1798,7 +1805,7 @@ def actualizar_titulos(item): item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels #Volvemos a la siguiente acción en el canal - return launcher.run(item) + return item def search(item, texto): From e4636b82211b69a089e879db0060ed4cc424b0a8 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Tue, 31 Jul 2018 13:14:36 +0200 Subject: [PATCH 2/8] =?UTF-8?q?Desambiguaci=C3=B3n=20de=20t=C3=ADtulos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ahora soporta que los canales reporten el título pasado por la web, por encima del título pasado por TMDB --- plugin.video.alfa/core/videolibrarytools.py | 12 +- plugin.video.alfa/lib/generictools.py | 175 +++++++++++++------- 2 files changed, 122 insertions(+), 65 deletions(-) diff --git a/plugin.video.alfa/core/videolibrarytools.py b/plugin.video.alfa/core/videolibrarytools.py index 8bff09ab..c06c5fa3 100644 --- a/plugin.video.alfa/core/videolibrarytools.py +++ b/plugin.video.alfa/core/videolibrarytools.py @@ -545,9 +545,9 @@ def add_movie(item): #Si se cancela la segunda pantalla, la variable "scraper_return" estará en False. El usuario no quiere seguir from lib import generictools - generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels - if item.tmdb_stat: - del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca + item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels + #if item.tmdb_stat: + # del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca new_item = item.clone(action="findvideos") insertados, sobreescritos, fallidos = save_movie(new_item) @@ -613,9 +613,9 @@ def add_tvshow(item, channel=None): #Si se cancela la segunda pantalla, la variable "scraper_return" estará en False. El usuario no quiere seguir from lib import generictools - generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels - if item.tmdb_stat: - del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca + item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels + #if item.tmdb_stat: + # del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca # Obtiene el listado de episodios itemlist = getattr(channel, item.action)(item) diff --git a/plugin.video.alfa/lib/generictools.py b/plugin.video.alfa/lib/generictools.py index 8027c314..0148dfa0 100644 --- a/plugin.video.alfa/lib/generictools.py +++ b/plugin.video.alfa/lib/generictools.py @@ -20,7 +20,7 @@ from core import servertools from core import channeltools from core import filetools from core.item import Item -from platformcode import config, logger +from platformcode import config, logger, platformtools from core import tmdb channel_py = "newpct1" @@ -69,25 +69,42 @@ def update_title(item): if item.from_action: item.action = item.from_action del item.from_action - if item.from_title: - item.title = item.from_title - del item.from_title - elif item.contentType != "movie": - item.add_videolibrary = True #Estamos Añadiendo a la Videoteca. Indicador para control de uso de los Canales - if item.contentType == "movie": - if item.channel == channel_py: #Si es una peli de NewPct1, ponemos el nombre del clone - item.channel = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/') - if item.channel_host: #Borramos ya el indicador para que no se guarde en la Videoteca - del item.channel_host - if item.contentTitle: - item.contentTitle = re.sub(r' -%s-' % item.category, '', item.contentTitle) - item.title = re.sub(r' -%s-' % item.category, '', item.title) + if item.from_update: + if item.from_title_tmdb: #Si se salvó el título del contenido devuelto por TMDB, se restaura. + item.title = item.from_title_tmdb + else: + item.add_videolibrary = True #Estamos Añadiendo a la Videoteca. Indicador para control de uso de los Canales + if item.add_videolibrary: + if item.contentType == "movie": + if item.from_title_tmdb: #Si se salvó el título del contenido devuelto por TMDB, se restaura. + item.title = item.from_title_tmdb + del item.add_videolibrary + if item.channel_host: #Borramos ya el indicador para que no se guarde en la Videoteca + del item.channel_host + if item.contentTitle: + item.contentTitle = re.sub(r' -%s-' % item.category, '', item.contentTitle) + item.title = re.sub(r' -%s-' % item.category, '', item.title) + if item.contentType == 'movie': + from_title_tmdb = item.contentTitle + else: + from_title_tmdb = item.contentSerieName - #Sólo ejecutamos este código si no se ha hecho antes en el Canal. Por ejemplo, si se ha llamado desde Episodios, + #Sólo ejecutamos este código si no se ha hecho antes en el Canal. Por ejemplo, si se ha llamado desde Episodios o Findvideos, #ya no se ejecutará al Añadia a Videoteca, aunque desde el canal se podrá llamar tantas veces como se quiera, #o hasta que encuentre un título no ambiguo - if not item.tmdb_stat: + if item.tmdb_stat: + if item.from_title_tmdb: del item.from_title_tmdb + if item.from_title: del item.from_title + item.from_update = True + del item.from_update + if item.contentType == "movie": + if item.channel == channel_py: #Si es una peli de NewPct1, ponemos el nombre del clone + item.channel = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/') + else: new_item = item.clone() #Salvamos el Item inicial para restaurarlo si el usuario cancela + if item.contentType == "movie": + if item.channel == channel_py: #Si es una peli de NewPct1, ponemos el nombre del clone + item.channel = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/') #Borramos los IDs y el año para forzar a TMDB que nos pregunte if item.infoLabels['tmdb_id'] or item.infoLabels['tmdb_id'] == None: item.infoLabels['tmdb_id'] = '' if item.infoLabels['tvdb_id'] or item.infoLabels['tvdb_id'] == None: item.infoLabels['tvdb_id'] = '' @@ -95,6 +112,16 @@ def update_title(item): if item.infoLabels['season']: del item.infoLabels['season'] #Funciona mal con num. de Temporada. Luego lo restauramos item.infoLabels['year'] = '-' + if item.from_title: + if item.from_title_tmdb: + if scrapertools.find_single_match(item.from_title_tmdb, '^(?:\[COLOR \w+\])?(.*?)(?:\[)'): + from_title_tmdb = scrapertools.find_single_match(item.from_title_tmdb, '^(?:\[COLOR \w+\])?(.*?)(?:\[)').strip() + item.title = item.title.replace(from_title_tmdb, item.from_title) + item.infoLabels['title'] = item.from_title + + if item.from_title_tmdb: del item.from_title_tmdb + if not item.from_update and item.from_title: del item.from_title + if item.contentSerieName: #Copiamos el título para que sirva de referencia en menú "Completar Información" item.infoLabels['originaltitle'] = item.contentSerieName item.contentTitle = item.contentSerieName @@ -109,57 +136,67 @@ def update_title(item): #Si el usuario ha cambiado los datos en "Completar Información" hay que ver el título definitivo en TMDB if not item.infoLabels['tmdb_id']: if item.contentSerieName: - item.contentSerieName = item.contentTitle #Se pone título nuevo - item.infoLabels['noscrap_id'] = '' #Se resetea, por si acaso - item.infoLabels['year'] = '-' #Se resetea, por si acaso - scraper_return = scraper.find_and_set_infoLabels(item) #Se intenta de nuevo + item.contentSerieName = item.contentTitle #Se pone título nuevo + item.infoLabels['noscrap_id'] = '' #Se resetea, por si acaso + item.infoLabels['year'] = '-' #Se resetea, por si acaso + scraper_return = scraper.find_and_set_infoLabels(item) #Se intenta de nuevo #Parece que el usuario ha cancelado de nuevo. Restituimos los datos a la situación inicial if not scraper_return or not item.infoLabels['tmdb_id']: item = new_item.clone() else: - item.tmdb_stat = True #Marcamos Item como procesado correctamente por TMDB (pasada 2) + item.tmdb_stat = True #Marcamos Item como procesado correctamente por TMDB (pasada 2) else: - item.tmdb_stat = True #Marcamos Item como procesado correctamente por TMDB (pasada 1) + item.tmdb_stat = True #Marcamos Item como procesado correctamente por TMDB (pasada 1) #Si el usuario ha seleccionado una opción distinta o cambiado algo, ajustamos los títulos + if item.contentType != 'movie' or item.from_update: + item.channel = new_item.channel #Restuaramos el nombre del canal, por si lo habíamos cambiado if item.tmdb_stat == True: if new_item.contentSerieName: #Si es serie... if config.get_setting("filter_languages", item.channel) >= 0: item.title_from_channel = new_item.contentSerieName #Guardo el título incial para Filtertools item.contentSerieName = new_item.contentSerieName #Guardo el título incial para Filtertools else: - item.title = item.title.replace(new_item.contentSerieName, item.contentTitle) + item.title = item.title.replace(new_item.contentSerieName, item.contentTitle).replace(from_title_tmdb, item.contentTitle) item.contentSerieName = item.contentTitle if new_item.contentSeason: item.contentSeason = new_item.contentSeason #Restauramos Temporada if item.infoLabels['title']: del item.infoLabels['title'] #Borramos título de peli (es serie) - else: #Si es película... - item.title = item.title.replace(new_item.contentTitle, item.contentTitle) - if new_item.infoLabels['year']: #Actualizamos el Año en el título + else: #Si es película... + item.title = item.title.replace(new_item.contentTitle, item.contentTitle).replace(from_title_tmdb, item.contentTitle) + if new_item.infoLabels['year']: #Actualizamos el Año en el título item.title = item.title.replace(str(new_item.infoLabels['year']), str(item.infoLabels['year'])) - if new_item.infoLabels['rating']: #Actualizamos en Rating en el título - rating_old = '' - if new_item.infoLabels['rating'] and new_item.infoLabels['rating'] != '0.0': - rating_old = float(new_item.infoLabels['rating']) - rating_old = round(rating_old, 1) - rating_new = '' - if item.infoLabels['rating'] and item.infoLabels['rating'] != '0.0': - rating_new = float(item.infoLabels['rating']) - rating_new = round(rating_new, 1) - item.title = item.title.replace("[" + str(rating_old) + "]", "[" + str(rating_new) + "]") - if item.wanted: #Actualizamos Wanted, si existe + if new_item.infoLabels['rating']: #Actualizamos en Rating en el título + try: + rating_old = '' + if new_item.infoLabels['rating'] and new_item.infoLabels['rating'] != '0.0': + rating_old = float(new_item.infoLabels['rating']) + rating_old = round(rating_old, 1) + rating_new = '' + if item.infoLabels['rating'] and item.infoLabels['rating'] != '0.0': + rating_new = float(item.infoLabels['rating']) + rating_new = round(rating_new, 1) + item.title = item.title.replace("[" + str(rating_old) + "]", "[" + str(rating_new) + "]") + except: + pass + if item.wanted: #Actualizamos Wanted, si existe item.wanted = item.contentTitle - if new_item.contentSeason: #Restauramos el núm. de Temporada después de TMDB + if new_item.contentSeason: #Restauramos el núm. de Temporada después de TMDB item.contentSeason = new_item.contentSeason + + if item.from_update: + item.from_update = True + del item.from_update + platformtools.itemlist_update(item) #Para evitar el "efecto memoria" de TMDB, se le llama con un título ficticio para que resetee los buffers if item.contentSerieName: - new_item.infoLabels['tmdb_id'] = '289' #una serie no ambigua + new_item.infoLabels['tmdb_id'] = '289' #una serie no ambigua else: - new_item.infoLabels['tmdb_id'] = '111' #una peli no ambigua + new_item.infoLabels['tmdb_id'] = '111' #una peli no ambigua new_item.infoLabels['year'] = '-' if new_item.contentSeason: - del new_item.infoLabels['season'] #Funciona mal con num. de Temporada + del new_item.infoLabels['season'] #Funciona mal con num. de Temporada scraper_return = scraper.find_and_set_infoLabels(new_item) #logger.debug(item) @@ -241,10 +278,16 @@ def post_tmdb_listado(item, itemlist): item_local.title_subs = [] del item_local.title_subs + if item_local.from_title: + if item_local.contentType == 'movie': + item_local.contentTitle = item_local.from_title + else: + item_local.contentSerieName = item_local.from_title + #Preparamos el Rating del vídeo rating = '' try: - if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0': + if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != 0.0: rating = float(item_local.infoLabels['rating']) rating = round(rating, 1) except: @@ -502,7 +545,7 @@ def post_tmdb_episodios(item, itemlist): #Preparamos el Rating del vídeo rating = '' try: - if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0': + if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != 0.0: rating = float(item_local.infoLabels['rating']) rating = round(rating, 1) except: @@ -572,7 +615,7 @@ def post_tmdb_episodios(item, itemlist): logger.error("ERROR 07: EPISODIOS: Num de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(num_temporada_max) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista)) #Permitimos la actualización de los títulos, bien para uso inmediato, o para añadir a la videoteca - itemlist.append(item.clone(title="** [COLOR yelow]Actualizar Títulos - vista previa videoteca[/COLOR] **", action="actualizar_titulos", tmdb_stat=False, from_action=item.action, from_title=item.title)) + itemlist.append(item.clone(title="** [COLOR yelow]Actualizar Títulos - vista previa videoteca[/COLOR] **", action="actualizar_titulos", tmdb_stat=False, from_action=item.action, from_title_tmdb=item.title, from_update=True)) #Borro num. Temporada si no viene de menú de Añadir a Videoteca y no está actualizando la Videoteca if not item.library_playcounts: #si no está actualizando la Videoteca @@ -716,7 +759,7 @@ def post_tmdb_findvideos(item, itemlist): rating = '' #Ponemos el rating try: - if item.infoLabels['rating'] and item.infoLabels['rating'] != '0.0': + if item.infoLabels['rating'] and item.infoLabels['rating'] != 0.0: rating = float(item.infoLabels['rating']) rating = round(rating, 1) except: @@ -733,15 +776,18 @@ def post_tmdb_findvideos(item, itemlist): elif item.contentChannel == 'videolibrary': #No hay, viene de la Videoteca? buscamos en la DB #Leo de la BD de Kodi la duración de la película o episodio. En "from_fields" se pueden poner las columnas que se quiera nun_records = 0 - if item.contentType == 'movie': - nun_records, records = get_field_from_kodi_DB(item, from_fields='c11') #Leo de la BD de Kodi la duración de la película - else: - nun_records, records = get_field_from_kodi_DB(item, from_fields='c09') #Leo de la BD de Kodi la duración del episodio + try: + if item.contentType == 'movie': + nun_records, records = get_field_from_kodi_DB(item, from_fields='c11') #Leo de la BD de Kodi la duración de la película + else: + nun_records, records = get_field_from_kodi_DB(item, from_fields='c09') #Leo de la BD de Kodi la duración del episodio + except: + pass if nun_records > 0: #Hay registros? #Es un array, busco el campo del registro: añadir en el FOR un fieldX por nueva columna for strFileName, field1 in records: tiempo = field1 - + try: #calculamos el timepo en hh:mm tiempo_final = int(tiempo) #lo convierto a int, pero puede se null if tiempo_final > 0: #Si el tiempo está a 0, pasamos @@ -749,7 +795,8 @@ def post_tmdb_findvideos(item, itemlist): tiempo_final = tiempo_final / 60 #Lo transformo a minutos horas = tiempo_final / 60 #Lo transformo a horas resto = tiempo_final - (horas * 60) #guardo el resto de minutos de la hora - item.quality += ' [%s:%s]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor + if not scrapertools.find_single_match(item.quality, '(\[\d+:\d+\])'): #si ya tiene la duración, pasamos + item.quality += ' [%s:%s]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor except: pass @@ -768,7 +815,7 @@ def post_tmdb_findvideos(item, itemlist): title = '%s al %s - ' % (title, scrapertools.find_single_match(item.title, 'al (\d+)')) else: title = '%s %s' % (title, item.infoLabels['episodio_titulo']) #Título Episodio - title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item.contentSerieName, item.infoLabels['year'], rating, item.quality, str(item.language), scrapertools.find_single_match(item.title, '\s\[(\d+,?\d*?\s\w[b|B])\]')) #Rating, Calidad, Idioma, Tamaño + title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item.contentSerieName, item.infoLabels['year'], rating, item.quality, str(item.language), scrapertools.find_single_match(item.title, '\s\[(\d+,?\d*?\s\w[b|B])\]')) #Rating, Calidad, Idioma, Tamaño if item.infoLabels['status'] and item.infoLabels['status'].lower() == "ended": title_gen = '[TERM.] %s' % title_gen #Marca cuando la Serie está terminada y no va a haber más producción item.title = title_gen @@ -803,8 +850,11 @@ def post_tmdb_findvideos(item, itemlist): itemlist.append(item.clone(action="", server = "", title=title_gen)) #Título con todos los datos del vídeo #agregamos la opción de Añadir a Videoteca para péliculas (no series) - if item.contentType == 'movie' and item.contentChannel != "videolibrary": - itemlist.append(item.clone(title="**-[COLOR yellow] Añadir a la videoteca [/COLOR]-**", action="add_pelicula_to_library", extra="películas", from_title=title_videoteca)) + if item.contentType == 'movie' and item.contentChannel != "videolibrary": + #Permitimos la actualización de los títulos, bien para uso inmediato, o para añadir a la videoteca + itemlist.append(item.clone(title="** [COLOR yelow]Actualizar Títulos - vista previa videoteca[/COLOR] **", action="actualizar_titulos", extra="películas", tmdb_stat=False, from_action=item.action, from_title_tmdb=item.title, from_update=True)) + + itemlist.append(item.clone(title="**-[COLOR yellow] Añadir a la videoteca [/COLOR]-**", action="add_pelicula_to_library", extra="películas", from_action=item.action, from_title_tmdb=item.title)) #Añadimos la opción de ver trailers if item.contentChannel != "videolibrary": @@ -833,11 +883,16 @@ def get_field_from_kodi_DB(item, from_fields='*', files='file'): FOLDER_MOVIES = config.get_setting("folder_movies") FOLDER_TVSHOWS = config.get_setting("folder_tvshows") VIDEOLIBRARY_PATH = config.get_videolibrary_config_path() + VIDEOLIBRARY_REAL_PATH = config.get_videolibrary_path() if item.contentType == 'movie': #Agrego la carpeta correspondiente al path de la Videoteca - path = filetools.join(VIDEOLIBRARY_PATH, FOLDER_MOVIES) + path = filetools.join(VIDEOLIBRARY_REAL_PATH, FOLDER_MOVIES) + path2 = filetools.join(VIDEOLIBRARY_PATH, FOLDER_MOVIES) + folder = FOLDER_MOVIES else: - path = filetools.join(VIDEOLIBRARY_PATH, FOLDER_TVSHOWS) + path = filetools.join(VIDEOLIBRARY_REAL_PATH, FOLDER_TVSHOWS) + path2 = filetools.join(VIDEOLIBRARY_PATH, FOLDER_TVSHOWS) + folder = FOLDER_TVSHOWS raiz, carpetas, ficheros = filetools.walk(path).next() #listo las series o películas en la Videoteca carpetas = [filetools.join(path, f) for f in carpetas] #agrego la carpeta del contenido al path @@ -845,10 +900,11 @@ def get_field_from_kodi_DB(item, from_fields='*', files='file'): if item.contentType == 'movie' and (item.contentTitle.lower() in carpeta or item.contentTitle in carpeta): #Películas? path = carpeta #Almacenamos la carpeta en el path break - elif item.contentType in ['tvshow', 'season', 'episode'] and (item.contentSerieName.lower() in carpeta or item.contentSerieName in carpeta): #Series? + elif item.contentType in ['tvshow', 'season', 'episode'] and (item.contentSerieName.lower() in carpeta or item.contentSerieName in carpeta): #Series? path = carpeta #Almacenamos la carpeta en el path break + path2 += '/%s/' % scrapertools.find_single_match(path, '%s.(.*?\s\[.*?\])' % folder) #Agregamos la carpeta de la Serie o Películas, formato Android file_search = '%' #Por defecto busca todos los archivos de la carpeta if files == 'file': #Si se ha pedido son un archivo (defecto), se busca if item.contentType == 'episode': #Si es episodio, se pone el nombre, si no de deja % @@ -865,7 +921,7 @@ def get_field_from_kodi_DB(item, from_fields='*', files='file'): else: contentType = "movie_view" #Marco la tabla de BBDD de Kodi Video path1 = path.replace("\\\\", "\\") #para la SQL solo necesito la carpeta - path2 = path.replace("\\", "/") #Formato no Windows + path2 = path2.replace("\\", "/") #Formato no Windows #Ejecutmos la sentencia SQL if not from_fields: @@ -1105,7 +1161,8 @@ def web_intervenida(item, data, desactivar=True): #Guardamos los cambios hechos en el .json try: if item.channel != channel_py: - disabled = config.set_setting('enabled', False, item.channel) + disabled = config.set_setting('enabled', False, item.channel) #Desactivamos el canal + disabled = config.set_setting('include_in_global_search', False, item.channel) #Lo sacamos de las búquedas globales channel_path = filetools.join(config.get_runtime_path(), "channels", item.channel + ".json") with open(channel_path, 'w') as outfile: #Grabamos el .json actualizado json.dump(json_data, outfile, sort_keys = True, indent = 2, ensure_ascii = False) From 3e29a898b0b517a97a1861f036f96ea112af5a7c Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Tue, 31 Jul 2018 13:15:26 +0200 Subject: [PATCH 3/8] httptools: muestra el contenido del post en el logger.debug --- plugin.video.alfa/core/httptools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.video.alfa/core/httptools.py b/plugin.video.alfa/core/httptools.py index ba6ddde2..30256c7d 100755 --- a/plugin.video.alfa/core/httptools.py +++ b/plugin.video.alfa/core/httptools.py @@ -139,7 +139,7 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr logger.info("URL: " + url) logger.info("Dominio: " + urlparse.urlparse(url)[1]) if post: - logger.info("Peticion: POST") + logger.info("Peticion: POST: %s" % post) else: logger.info("Peticion: GET") logger.info("Usar Cookies: %s" % cookies) From e0af2b83ef972df556bb3694afa8bab433c90069 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Tue, 31 Jul 2018 16:18:34 +0200 Subject: [PATCH 4/8] =?UTF-8?q?Mejoras=20de=20c=C3=B3digo=20interno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.video.alfa/channels/alltorrent.py | 3 --- plugin.video.alfa/channels/elitetorrent.py | 3 --- plugin.video.alfa/channels/grantorrent.py | 3 --- plugin.video.alfa/channels/mejortorrent1.py | 3 --- plugin.video.alfa/channels/newpct1.py | 3 --- 5 files changed, 15 deletions(-) diff --git a/plugin.video.alfa/channels/alltorrent.py b/plugin.video.alfa/channels/alltorrent.py index aa761c32..2f9ec7cd 100755 --- a/plugin.video.alfa/channels/alltorrent.py +++ b/plugin.video.alfa/channels/alltorrent.py @@ -268,9 +268,6 @@ def findvideos(item): def actualizar_titulos(item): logger.info() - itemlist = [] - - from platformcode import launcher item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels diff --git a/plugin.video.alfa/channels/elitetorrent.py b/plugin.video.alfa/channels/elitetorrent.py index 86a1930d..fccba66c 100644 --- a/plugin.video.alfa/channels/elitetorrent.py +++ b/plugin.video.alfa/channels/elitetorrent.py @@ -342,9 +342,6 @@ def findvideos(item): def actualizar_titulos(item): logger.info() - itemlist = [] - - from platformcode import launcher item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels diff --git a/plugin.video.alfa/channels/grantorrent.py b/plugin.video.alfa/channels/grantorrent.py index cfa78a18..4ecf072a 100644 --- a/plugin.video.alfa/channels/grantorrent.py +++ b/plugin.video.alfa/channels/grantorrent.py @@ -814,9 +814,6 @@ def episodios(item): def actualizar_titulos(item): logger.info() - itemlist = [] - - from platformcode import launcher item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels diff --git a/plugin.video.alfa/channels/mejortorrent1.py b/plugin.video.alfa/channels/mejortorrent1.py index 33d7a0c1..4718f6a8 100644 --- a/plugin.video.alfa/channels/mejortorrent1.py +++ b/plugin.video.alfa/channels/mejortorrent1.py @@ -976,9 +976,6 @@ def episodios(item): def actualizar_titulos(item): logger.info() - itemlist = [] - - from platformcode import launcher item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index 2d14a510..d7167df8 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -1798,9 +1798,6 @@ def episodios(item): def actualizar_titulos(item): logger.info() - itemlist = [] - - from platformcode import launcher item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels From 681300450b574c5cebf9aba3ad29017c527e5cb1 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Tue, 31 Jul 2018 16:18:53 +0200 Subject: [PATCH 5/8] Revert "httptools: muestra el contenido del post en el logger.debug" This reverts commit 3e29a898b0b517a97a1861f036f96ea112af5a7c. --- plugin.video.alfa/core/httptools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.video.alfa/core/httptools.py b/plugin.video.alfa/core/httptools.py index 30256c7d..ba6ddde2 100755 --- a/plugin.video.alfa/core/httptools.py +++ b/plugin.video.alfa/core/httptools.py @@ -139,7 +139,7 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr logger.info("URL: " + url) logger.info("Dominio: " + urlparse.urlparse(url)[1]) if post: - logger.info("Peticion: POST: %s" % post) + logger.info("Peticion: POST") else: logger.info("Peticion: GET") logger.info("Usar Cookies: %s" % cookies) From 839e02513a8c01bc70ca852795253078f553b382 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Tue, 31 Jul 2018 16:30:54 +0200 Subject: [PATCH 6/8] =?UTF-8?q?Mejora=20de=20c=C3=B3digo=20interno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.video.alfa/channels/newpct1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index d7167df8..3da3f9d4 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -405,8 +405,8 @@ def listado(item): itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - logger.debug("MATCHES: " + str(len(matches))) - logger.debug(matches) + #logger.debug("MATCHES: " + str(len(matches))) + #logger.debug(matches) #logger.debug("patron: " + patron + " / fichas: " + fichas) # Identifico la página actual y el total de páginas para el pie de página From 5701585bc144c5e0fb6f0a0d4362c54c9fc8ddfe Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 1 Aug 2018 13:43:24 +0200 Subject: [PATCH 7/8] Alltorrent y Zentorrents: baja por inactividad --- plugin.video.alfa/channels/alltorrent.json | 2 +- plugin.video.alfa/channels/zentorrents.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/channels/alltorrent.json b/plugin.video.alfa/channels/alltorrent.json index e2188b7b..ae9bbebe 100755 --- a/plugin.video.alfa/channels/alltorrent.json +++ b/plugin.video.alfa/channels/alltorrent.json @@ -1,7 +1,7 @@ { "id": "alltorrent", "name": "Alltorrent", - "active": true, + "active": false, "adult": false, "language": ["cast"], "thumbnail": "altorrent.png", diff --git a/plugin.video.alfa/channels/zentorrents.json b/plugin.video.alfa/channels/zentorrents.json index ca5d922a..fa567d66 100755 --- a/plugin.video.alfa/channels/zentorrents.json +++ b/plugin.video.alfa/channels/zentorrents.json @@ -1,7 +1,7 @@ { "id": "zentorrents", "name": "Zentorrent", - "active": true, + "active": false, "adult": false, "language": ["cast"], "banner": "zentorrents.png", From c2e0beb5db4c30c2e6f26793d98821a0fe9933fd Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 1 Aug 2018 21:00:18 +0200 Subject: [PATCH 8/8] =?UTF-8?q?TMDB:=20agrega=20"duration"=20tambi=C3=A9n?= =?UTF-8?q?=20para=20episodios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El campo que devueve TMDB para episodio se llama 'episode_run_time' en vez de 'runtime'. Además, viene como una lista, aunque con un solo valor --- plugin.video.alfa/core/tmdb.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugin.video.alfa/core/tmdb.py b/plugin.video.alfa/core/tmdb.py index d58936c6..d1618948 100644 --- a/plugin.video.alfa/core/tmdb.py +++ b/plugin.video.alfa/core/tmdb.py @@ -1541,8 +1541,15 @@ class Tmdb(object): else: ret_infoLabels['plot'] = self.get_sinopsis() - elif k == 'runtime': + elif k == 'runtime': #Duration for movies ret_infoLabels['duration'] = int(v) * 60 + + elif k == 'episode_run_time': #Duration for episodes + try: + for v_alt in v: #It comes as a list (?!) + ret_infoLabels['duration'] = int(v_alt) * 60 + except: + pass elif k == 'release_date': ret_infoLabels['year'] = int(v[:4])