From ab0c17c77c1d265f0412e82c9fc121957d9098bf Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 27 Jun 2018 20:59:17 +0200 Subject: [PATCH] Clones NewPct1: soporte Fail-over MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adaptción de los clones de NewPct1 para saltar de una web caída a otra activa EliteTorrent y MejorTorrent: soporte de librería de código reutilizable --- plugin.video.alfa/channels/descargas2020.py | 189 ++++-- plugin.video.alfa/channels/elitetorrent.py | 414 +++--------- plugin.video.alfa/channels/grantorrent.py | 29 +- plugin.video.alfa/channels/mejortorrent.py | 599 +++++++----------- plugin.video.alfa/channels/mispelisyseries.py | 189 ++++-- plugin.video.alfa/channels/torrentlocura.py | 189 ++++-- plugin.video.alfa/channels/torrentrapid.json | 24 + plugin.video.alfa/channels/torrentrapid.py | 189 ++++-- plugin.video.alfa/channels/tumejortorrent.py | 189 ++++-- plugin.video.alfa/channels/tvsinpagar.py | 189 ++++-- plugin.video.alfa/lib/generictools.py | 323 ++++++++-- 11 files changed, 1489 insertions(+), 1034 deletions(-) diff --git a/plugin.video.alfa/channels/descargas2020.py b/plugin.video.alfa/channels/descargas2020.py index 01aed6bb..98e005c6 100644 --- a/plugin.video.alfa/channels/descargas2020.py +++ b/plugin.video.alfa/channels/descargas2020.py @@ -5,6 +5,7 @@ import sys import urllib import urlparse import datetime +import ast from channelselector import get_thumb from core import httptools @@ -17,15 +18,34 @@ from lib import generictools host = 'http://descargas2020.com/' +#Código para permitir usar un único canal para todas las webs clones de NewPct1 +clone_list = config.get_setting('clonenewpct1_channels_list', "torrentrapid") #Carga lista de clones +clone_list = ast.literal_eval(clone_list) #la convierte a lista de tuplas +host_index = 0 +host_index = config.get_setting('clonenewpct1_channel_default', "torrentrapid") #Clone por defecto +i = 0 +for active_clone, channel_clone, host_clone, contentType_clone, info_clone in clone_list: + if i == host_index: + #channel_clone_name = channel_clone #ACTIVAR CUANDO SE PASE A NEWPCT1 + #host = 'http://%s/' % host_clone #ACTIVAR CUANDO SE PASE A NEWPCT1 + i += 1 + +#Carga de opciones del canal item = Item() if not item.channel: item.channel = scrapertools.find_single_match(host, r'(\w+)\.com\/') +channel_clone_name = scrapertools.find_single_match(host, r'(\w+)\.com\/') #QUITAR CUANDO SE PASE A NEWPCT1 __modo_grafico__ = config.get_setting('modo_grafico', item.channel) modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', item.channel) + def mainlist(item): logger.info() + #Renombramos el canal al nombre de clone elegido + item.channel = channel_clone_name + if item.category: item.category = channel_clone_name.capitalize() + itemlist = [] thumb_pelis = get_thumb("channels_movie.png") @@ -64,20 +84,40 @@ def settingCanal(item): def submenu(item): logger.info() itemlist = [] - + 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: " + item.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 - + pass + + host_alt = host host_dom = host.replace("https://", "").replace("http://", "").replace("www.", "") patron = '