From 969403fc771afdddcb53766a58b4551fbe5997c0 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Fri, 1 Jun 2018 19:41:34 +0200 Subject: [PATCH] =?UTF-8?q?Clones=20NewPct1:=20mejoras=20internas,=20gesti?= =?UTF-8?q?=C3=B3n=20de=20errores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.video.alfa/channels/descargas2020.json | 8 + plugin.video.alfa/channels/descargas2020.py | 159 +++++++++++++----- .../channels/mispelisyseries.json | 8 + plugin.video.alfa/channels/mispelisyseries.py | 159 +++++++++++++----- plugin.video.alfa/channels/torrentlocura.json | 8 + plugin.video.alfa/channels/torrentlocura.py | 159 +++++++++++++----- plugin.video.alfa/channels/torrentrapid.json | 8 + plugin.video.alfa/channels/torrentrapid.py | 159 +++++++++++++----- .../channels/tumejortorrent.json | 8 + plugin.video.alfa/channels/tumejortorrent.py | 159 +++++++++++++----- plugin.video.alfa/channels/tvsinpagar.json | 8 + plugin.video.alfa/channels/tvsinpagar.py | 159 +++++++++++++----- 12 files changed, 744 insertions(+), 258 deletions(-) diff --git a/plugin.video.alfa/channels/descargas2020.json b/plugin.video.alfa/channels/descargas2020.json index b6b22008..d159b644 100755 --- a/plugin.video.alfa/channels/descargas2020.json +++ b/plugin.video.alfa/channels/descargas2020.json @@ -22,6 +22,14 @@ "enabled": true, "visible": true }, + { + "id": "modo_grafico", + "type": "bool", + "label": "Buscar información extra (TMDB)", + "default": true, + "enabled": true, + "visible": true + }, { "id": "clonenewpct1_ver_enlaces_veronline", "type": "list", diff --git a/plugin.video.alfa/channels/descargas2020.py b/plugin.video.alfa/channels/descargas2020.py index 241d2456..906edb96 100644 --- a/plugin.video.alfa/channels/descargas2020.py +++ b/plugin.video.alfa/channels/descargas2020.py @@ -15,6 +15,11 @@ from core import tmdb host = 'http://descargas2020.com/' +item = Item() +if not item.channel: + item.channel = scrapertools.find_single_match(host, r'(\w+)\.com\/') +__modo_grafico__ = config.get_setting('modo_grafico', item.channel) + def mainlist(item): logger.info() @@ -57,7 +62,12 @@ def submenu(item): logger.info() itemlist = [] - data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) + return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com @@ -68,11 +78,19 @@ def submenu(item): else: if data: data = scrapertools.get_match(data, patron) + 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.channel.capitalize() + '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 else: - return itemlist + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos patron = '<.*?href="([^"]+)".*?>([^>]+)' matches = re.compile(patron, re.DOTALL).findall(data) + 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.channel.capitalize() + '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 for scrapedurl, scrapedtitle in matches: title = scrapedtitle.strip() @@ -106,6 +124,10 @@ def alfabeto(item): patron = ']+>([^>]+)' matches = re.compile(patron, re.DOTALL).findall(data) + 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.channel.capitalize() + '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 for scrapedurl, scrapedtitle in matches: title = scrapedtitle.upper() @@ -130,7 +152,12 @@ def listado(item): if item.totalItems: del item.totalItems - data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + 'ERROR 01: LISTADO:. 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 #Establecemos los valores básicos en función del tipo de contenido if item.extra == "peliculas": @@ -150,6 +177,10 @@ def listado(item): patron = '