Merge pull request #512 from lopezvg/master

Newpct1: Nuevo clone Pctnew y calidades en HD
This commit is contained in:
Alfa
2018-12-19 12:10:42 -05:00
committed by GitHub
4 changed files with 40 additions and 9 deletions
+2 -1
View File
@@ -82,6 +82,7 @@
"Descargas2020", "Descargas2020",
"Tumejortorrent", "Tumejortorrent",
"Torrentrapid", "Torrentrapid",
"Pctnew",
"Torrentlocura", "Torrentlocura",
"Tvsinpagar", "Tvsinpagar",
"Planetatorrent", "Planetatorrent",
@@ -92,7 +93,7 @@
"id": "clonenewpct1_channels_list", "id": "clonenewpct1_channels_list",
"type": "text", "type": "text",
"label": "Lista de clones de NewPct1 y orden de uso", "label": "Lista de clones de NewPct1 y orden de uso",
"default": "('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')", "default": "('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'pctnew', 'http://pctnew.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')",
"enabled": true, "enabled": true,
"visible": false "visible": false
}, },
+28 -8
View File
@@ -44,19 +44,19 @@ clone_list_random = []
if host_index == 0: #Si el clones es "Aleatorio"... if host_index == 0: #Si el clones es "Aleatorio"...
i = 0 i = 0
j = 2 #... marcamos el último de los clones "buenos" j = 3 #... marcamos el último de los clones "buenos"
for active_clone, channel_clone, host_clone, contentType_clone, info_clone in clone_list: for active_clone, channel_clone, host_clone, contentType_clone, info_clone in clone_list:
if i <= j and active_clone == "1": if i <= j and active_clone == "1":
clone_list_random += [clone_list[i]] #... añadimos el clone activo "bueno" a la lista clone_list_random += [clone_list[i]] #... añadimos el clone activo "bueno" a la lista
else: else:
break break
i += 1 i += 1
if clone_list_random: #Si hay clones en la lista aleatoria... if clone_list_random: #Si hay clones en la lista aleatoria...
clone_list = [random.choice(clone_list_random)] #Seleccionamos un clone aleatorio clone_list = [random.choice(clone_list_random)] #Seleccionamos un clone aleatorio
#logger.debug(clone_list) #logger.debug(clone_list)
host_index = 1 #mutamos el num. de clone para que se procese en el siguiente loop host_index = 1 #mutamos el num. de clone para que se procese en el siguiente loop
if host_index > 0 or not clone_list_random: #Si el Clone por defecto no es Aleatorio, o hay ya un aleatorio sleccionado... if host_index > 0 or not clone_list_random: #Si el Clone por defecto no es Aleatorio, o hay ya un aleatorio sleccionado...
i = 1 i = 1
for active_clone, channel_clone, host_clone, contentType_clone, info_clone in clone_list: for active_clone, channel_clone, host_clone, contentType_clone, info_clone in clone_list:
if i == host_index: if i == host_index:
@@ -202,20 +202,29 @@ def submenu(item):
if "pelisyseries.com" in item.channel_host and item.extra == "varios": #compatibilidad con mispelisy.series.com if "pelisyseries.com" in item.channel_host and item.extra == "varios": #compatibilidad con mispelisy.series.com
data = '<li><a href="' + item.channel_host + 'varios/" title="Documentales">Documentales</a></li>' data = '<li><a href="' + item.channel_host + 'varios/" title="Documentales">Documentales</a></li>'
else: else:
data = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa data_menu = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa
if not data: if not data_menu:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + 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')) 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 = '<li><a.*?href="([^"]+)"\s?.itle="[^"]+"\s?>([^>]+)<\/a><\/li>' patron = '<li><a.*?href="([^"]+)"\s?.itle="[^"]+"\s?>([^>]+)<\/a><\/li>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data_menu)
if not matches: if not matches:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data_menu)
itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log')) 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
matches_hd = []
if item.extra == "peliculas":
patron = '<h3\s*(?:style="[^"]+")?>(?:<strong>)?Peliculas(?:<\/strong>)? en HD <a href="[^"]+"\s*class="[^"]+"\s*title="[^"]+">(?:ver .*?)?<\/a><span(?: style="[^"]+")?>(.*?)(?:<\/span>)?<\/h3>'
data_hd = scrapertools.find_single_match(data, patron) #Seleccionamos el trozo que nos interesa
if data_hd:
patron = '<a href="([^"]+)"\s*.itle="[^"]+"\s*>([^<]+)<\/a>'
matches_hd = re.compile(patron, re.DOTALL).findall(data_hd)
#logger.debug(matches_hd)
for scrapedurl, scrapedtitle in matches: for scrapedurl, scrapedtitle in matches:
title = scrapedtitle.strip() title = scrapedtitle.strip()
@@ -229,8 +238,19 @@ def submenu(item):
item.extra2 = "" item.extra2 = ""
itemlist.append(item.clone(action="listado", title=title, url=scrapedurl)) itemlist.append(item.clone(action="listado", title=title, url=scrapedurl))
if matches_hd and 'HD' in title:
for scrapedurlcat, scrapedtitlecat in matches_hd: #Pintamos las categorías de peliculas en HD
if '4k' in scrapedtitlecat.lower(): #... ignoramos 4K, no funcionan las categorías
continue
itemlist.append(item.clone(action="listado", title=" - Calidad: " + scrapedtitlecat, url=scrapedurlcat))
itemlist.append(item.clone(action="alfabeto", title=title + " [A-Z]", url=scrapedurl)) itemlist.append(item.clone(action="alfabeto", title=title + " [A-Z]", url=scrapedurl))
if item.extra == "varios" and len(itemlist) == 0:
itemlist.append(item.clone(action="listado", title="Varios", url=item.channel_host + "varios/"))
itemlist.append(item.clone(action="alfabeto", title="Varios" + " [A-Z]", url=item.channel_host + "varios/"))
if item.extra == "peliculas": if item.extra == "peliculas":
itemlist.append(item.clone(action="listado", title="Películas 4K", url=item.channel_host + "peliculas-hd/4kultrahd/")) itemlist.append(item.clone(action="listado", title="Películas 4K", url=item.channel_host + "peliculas-hd/4kultrahd/"))
itemlist.append(item.clone(action="alfabeto", title="Películas 4K" + " [A-Z]", url=item.channel_host + "peliculas-hd/4kultrahd/")) itemlist.append(item.clone(action="alfabeto", title="Películas 4K" + " [A-Z]", url=item.channel_host + "peliculas-hd/4kultrahd/"))
@@ -49,9 +49,15 @@ def connect(url):
# logger.info("Url: %s" % url) # logger.info("Url: %s" % url)
global remote global remote
server_name, server_ip, share_name, path, user, password, domain = parse_url(url) server_name, server_ip, share_name, path, user, password, domain = parse_url(url)
#Da problemas asumir que la sesión está abierta. Si se abrió pero ha caducado, dará error. Mejor conectar siempre
"""
if not remote or not remote.sock or not server_name == remote.remote_name: if not remote or not remote.sock or not server_name == remote.remote_name:
remote = SMBConnection(user, password, domain, server_name) remote = SMBConnection(user, password, domain, server_name)
remote.connect(server_ip, 139) remote.connect(server_ip, 139)
"""
remote = SMBConnection(user, password, domain, server_name)
remote.connect(ip=server_ip, timeout=20)
return remote, share_name, path return remote, share_name, path
@@ -152,6 +152,10 @@ def render_items(itemlist, parent_item):
if item.category == "": if item.category == "":
item.category = parent_item.category item.category = parent_item.category
# Si title no existe, lo iniciamos como str, para evitar errones "NoType"
if not item.title:
item.title = ''
# Si el item no contiene fanart, le ponemos el del item padre # Si el item no contiene fanart, le ponemos el del item padre
if item.fanart == "": if item.fanart == "":
item.fanart = parent_item.fanart item.fanart = parent_item.fanart