From 5d3e7f38de106d8444e9d677b3daa4dfee4a3353 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 22 Aug 2018 17:38:54 +0200 Subject: [PATCH] NewPct1: mejoras de alta disponibilidad episodios --- plugin.video.alfa/channels/elitetorrent.py | 1 + plugin.video.alfa/channels/mejortorrent1.py | 6 +- plugin.video.alfa/channels/newpct1.json | 2 +- plugin.video.alfa/channels/newpct1.py | 534 +++++++++++--------- plugin.video.alfa/lib/generictools.py | 135 +++-- 5 files changed, 380 insertions(+), 298 deletions(-) diff --git a/plugin.video.alfa/channels/elitetorrent.py b/plugin.video.alfa/channels/elitetorrent.py index c4b74f07..0faf759c 100644 --- a/plugin.video.alfa/channels/elitetorrent.py +++ b/plugin.video.alfa/channels/elitetorrent.py @@ -377,6 +377,7 @@ def newest(categoria): if categoria == 'torrent': item.url = host item.extra = "peliculas" + item.category_new= 'newest' itemlist = listado(item) if itemlist[-1].title == "Página siguiente >>": diff --git a/plugin.video.alfa/channels/mejortorrent1.py b/plugin.video.alfa/channels/mejortorrent1.py index 4718f6a8..f2cf315f 100644 --- a/plugin.video.alfa/channels/mejortorrent1.py +++ b/plugin.video.alfa/channels/mejortorrent1.py @@ -1008,10 +1008,11 @@ def newest(categoria): try: if categoria == 'peliculas': item.url = host + "peliculas/" - item.extra = "novedades" + item.extra = "peliculas" item.channel = "mejortorrent1" + item.category_new= 'newest' item.tipo = False - itemlist = listado_busqueda(item) + itemlist = listado(item) if "Pagina siguiente >>" in itemlist[-1].title: itemlist.pop() @@ -1019,6 +1020,7 @@ def newest(categoria): item.url = host + "documentales/" item.extra = "documentales" item.channel = "mejortorrent1" + item.category_new= 'newest' item.tipo = False itemlist = listado(item) if "Pagina siguiente >>" in itemlist[-1].title: diff --git a/plugin.video.alfa/channels/newpct1.json b/plugin.video.alfa/channels/newpct1.json index c01d3a25..63ed5864 100644 --- a/plugin.video.alfa/channels/newpct1.json +++ b/plugin.video.alfa/channels/newpct1.json @@ -534,7 +534,7 @@ { "id": "include_in_newest_latino", "type": "bool", - "label": "Incluir en Novedades - Documentales", + "label": "Incluir en Novedades - Latino", "default": true, "enabled": true, "visible": false diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index ed7d1ed5..489713fc 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -62,9 +62,9 @@ elif fecha_rango == 4: fecha_rango = 'Siempre' episodio_serie = config.get_setting('clonenewpct1_serie_episodio_novedades', channel_py) #Episodio o serie para Novedades #Temporal, sólo para actualizar newpct1_data.json con otro valor por defecto -channel_banned = config.get_setting('clonenewpct1_excluir1_enlaces_veronline', channel_py) #1er Canal baneado -if channel_banned == 9: - config.set_setting('clonenewpct1_excluir1_enlaces_veronline', 22, channel_py) #se pone el nuevo valor por defecto +#channel_banned = config.get_setting('clonenewpct1_excluir1_enlaces_veronline', channel_py) #1eer Canal baneado +#if channel_banned == 9: +# config.set_setting('clonenewpct1_excluir1_enlaces_veronline', 22, channel_py) #se pone el nuevo valor por defecto def mainlist(item): @@ -86,9 +86,9 @@ def mainlist(item): thumb_buscar = get_thumb("search.png") thumb_settings = get_thumb("setting_0.png") - if channel_clone_name == "*** DOWN ***": #Ningún clones activo !!! + if channel_clone_name == "*** DOWN ***": #Ningún clones activo !!! itemlist.append(item.clone(action='', title="[COLOR yellow]Ningún canal NewPct1 activo[/COLOR]")) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos y salimos + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos y salimos itemlist.append(Item(channel=item.channel, action="submenu_novedades", title="Novedades", url=item.channel_host + "ultimas-descargas/", extra="novedades", thumbnail=thumb_pelis, category=item.category, channel_host=item.channel_host)) @@ -148,8 +148,8 @@ def submenu(item): if not data: #Si no ha logrado encontrar nada, salimos itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - elif item.channel_alt: #Si ha habido fail-over, lo comento + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + elif item.channel_alt: #Si ha habido fail-over, lo comento itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR] [ALT ] en uso')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel_alt.capitalize() + '[/COLOR] inaccesible')) @@ -157,15 +157,15 @@ def submenu(item): del item.channel_alt data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") - data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com - if "pelisyseries.com" in item.channel_host and item.extra == "varios": #compatibilidad con mispelisy.series.com + data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com + if "pelisyseries.com" in item.channel_host and item.extra == "varios": #compatibilidad con mispelisy.series.com data = '
  • Documentales
  • ' else: - data = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa + data = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa if not data: logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: 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 + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos patron = '
  • ([^>]+)<\/a><\/li>' matches = re.compile(patron, re.DOTALL).findall(data) @@ -173,7 +173,7 @@ def submenu(item): if not matches: logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: 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 + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos for scrapedurl, scrapedtitle in matches: title = scrapedtitle.strip() @@ -197,7 +197,7 @@ def submenu_novedades(item): itemlist_alt = [] data = '' - timeout_search=timeout * 2 #Más tiempo para Novedades, que es una búsqueda + timeout_search=timeout * 2 #Más tiempo para Novedades, que es una búsqueda thumb_settings = get_thumb("setting_0.png") #Establecer los valores del .json por si se entra directamente desde un favorito @@ -206,9 +206,9 @@ def submenu_novedades(item): item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize() item.extra = "novedades" - if channel_clone_name == "*** DOWN ***": #Ningún clones activo !!! + if channel_clone_name == "*** DOWN ***": #Ningún clones activo !!! itemlist.append(item.clone(action='', title="[COLOR yellow]Ningún canal NewPct1 activo[/COLOR]")) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos y salimos + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos y salimos try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, timeout=timeout_search).data) @@ -229,20 +229,20 @@ def submenu_novedades(item): #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú item, data = generictools.fail_over_newpct1(item, patron) - if not data: #Si no ha logrado encontrar nada, salimos + if not data: #Si no ha logrado encontrar nada, salimos itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - elif item.channel_alt: #Si ha habido fail-over, lo comento + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + elif item.channel_alt: #Si ha habido fail-over, lo comento itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR] [ALT ] en uso')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel_alt.capitalize() + '[/COLOR] inaccesible')) if item.url_alt: del item.url_alt del item.channel_alt - data = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa + data = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") - data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com + data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com patron = '