Merge remote-tracking branch 'origin/master'

This commit is contained in:
Unknown
2018-06-24 17:33:56 +02:00
25 changed files with 1374 additions and 2323 deletions
+19 -18
View File
@@ -287,7 +287,6 @@ def findvideos(item):
strm_id = scrapertools.find_single_match(data, '"id": (.*?),')
streams = scrapertools.find_single_match(data, '"stream": (.*?)};')
dict_strm = jsontools.load(streams)
base_url = 'http:%s%s/' % (dict_strm['accessPoint'], strm_id)
for server in dict_strm['servers']:
expire = dict_strm['expire']
@@ -297,24 +296,26 @@ def findvideos(item):
strm_url = base_url +'%s?expire=%s&callback=%s&signature=%s&last_modify=%s' % (server, expire, callback,
signature, last_modify)
strm_data = httptools.downloadpage(strm_url).data
strm_data = scrapertools.unescape(strm_data)
title = '%s'
language = ''
if server not in ['fire', 'meph']:
urls = scrapertools.find_multiple_matches(strm_data, '"(?:file|src)"*?:.*?"(.*?)"')
for url in urls:
try:
strm_data = httptools.downloadpage(strm_url).data
strm_data = scrapertools.unescape(strm_data)
title = '%s'
language = ''
if server not in ['fire', 'meph']:
urls = scrapertools.find_multiple_matches(strm_data, '"(?:file|src)"*?:.*?"(.*?)"')
for url in urls:
if url != '':
url = url.replace ('\\/','/')
itemlist.append(Item(channel=item.channel, title=title, url=url, action='play'))
elif server in ['fire', 'mpeh']:
url = scrapertools.find_single_match(strm_data, 'xmlhttp.open(\"GET\", \"(.*?)\"')
if url != '':
url = url.replace ('\\/','/')
itemlist.append(Item(channel=item.channel, title=title, url=url, action='play'))
elif server in ['fire', 'mpeh']:
url = scrapertools.find_single_match(strm_data, 'xmlhttp.open(\"GET\", \"(.*?)\"')
if url != '':
url = url.replace('\\/', '/')
itemlist.append(Item(channel=item.channel, title=url, url=url, action='play'))
else:
continue
url = url.replace('\\/', '/')
itemlist.append(Item(channel=item.channel, title=url, url=url, action='play'))
else:
continue
except:
pass
servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server)
+23 -3
View File
@@ -344,7 +344,7 @@ def start(itemlist, item):
return itemlist
def init(channel, list_servers, list_quality):
def init(channel, list_servers, list_quality, reset=False):
'''
Comprueba la existencia de canal en el archivo de configuracion de Autoplay y si no existe lo añade.
Es necesario llamar a esta funcion al entrar a cualquier canal que incluya la funcion Autoplay.
@@ -360,6 +360,7 @@ def init(channel, list_servers, list_quality):
change = False
result = True
if not config.is_xbmc():
# platformtools.dialog_notification('AutoPlay ERROR', 'Sólo disponible para XBMC/Kodi')
result = False
@@ -371,7 +372,7 @@ def init(channel, list_servers, list_quality):
change = True
autoplay_node = {"AUTOPLAY": {}}
if channel not in autoplay_node:
if channel not in autoplay_node or reset:
change = True
# Se comprueba que no haya calidades ni servidores duplicados
@@ -573,9 +574,15 @@ def autoplay_config(item):
list_controls.append(set_priority)
dict_values["priority"] = settings_node.get("priority", 0)
# Abrir cuadro de dialogo
platformtools.show_channel_settings(list_controls=list_controls, dict_values=dict_values, callback='save',
item=item, caption='%s - AutoPlay' % channel_name)
item=item, caption='%s - AutoPlay' % channel_name,
custom_button={'visible': True,
'function': "reset",
'close': True,
'label': 'Reset'})
def save(item, dict_data_saved):
@@ -654,3 +661,16 @@ def is_active():
settings_node = channel_node.get('settings', {})
return settings_node.get('active', False)
def reset(item, dict):
channel_name = item.from_channel
channel = __import__('channels.%s' % channel_name, fromlist=["channels.%s" % channel_name])
list_servers = channel.list_servers
list_quality = channel.list_quality
init(channel_name, list_servers, list_quality, reset=True)
platformtools.dialog_notification('AutoPlay', '%s: Los datos fueron reiniciados' % item.category)
return
+68 -296
View File
@@ -4,6 +4,7 @@ import re
import sys
import urllib
import urlparse
import datetime
from channelselector import get_thumb
from core import httptools
@@ -12,6 +13,7 @@ from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
from lib import generictools
host = 'http://descargas2020.com/'
@@ -145,11 +147,7 @@ def listado(item):
clase = "pelilist" # etiqueta para localizar zona de listado de contenidos
url_next_page ='' # Controlde paginación
cnt_tot = 30 # Poner el num. máximo de items por página
category = "" # Guarda la categoria que viene desde una busqueda global
if item.category:
category = item.category
del item.category
if item.totalItems:
del item.totalItems
@@ -258,8 +256,10 @@ def listado(item):
del item_local.tipo
if item_local.totalItems:
del item_local.totalItems
if item.post_num:
del item.post_num
if item_local.post_num:
del item_local.post_num
if item_local.category:
del item_local.category
item_local.title = ''
item_local.context = "['buscar_trailer']"
@@ -336,8 +336,8 @@ def listado(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("Espa", "").replace("Ingl", "").replace("Engl", "").replace("Calidad", "").replace("de la Serie", "")
title_alt = title_alt.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Espa", "").replace("Ingl", "").replace("Engl", "").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", "")
title_alt = title_alt.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)
@@ -347,7 +347,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -403,65 +403,8 @@ def listado(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
if category == "newest": #Viene de Novedades. Marquemos el título con el nombre del canal
title += ' -%s-' % item_local.channel.capitalize()
if item_local.contentType == "movie":
item_local.contentTitle += ' -%s-' % item_local.channel.capitalize()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if len(itemlist) == 0:
itemlist.append(Item(channel=item.channel, action="mainlist", title="No se ha podido cargar el listado"))
@@ -728,7 +671,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("Esp", "").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("Ing", "").replace("Eng", "").replace("Calidad", "").replace("de la Serie", "")
#Limpiamos cabeceras y colas del título
title = re.sub(r'Descargar\s\w+\-\w+', '', title)
@@ -738,7 +681,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -868,64 +811,8 @@ def listado_busqueda(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
title += " -Serie-"
elif item_local.extra == "varios":
title += " -Varios-"
item_local.contentTitle += " -Varios-"
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + "[" + str(item_local.language) + "]" + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if post:
itemlist.append(item.clone(channel=item.channel, action="listado_busqueda", title="[COLOR gold][B]Pagina siguiente >> [/B][/COLOR]" + str(post_num) + " de " + str(total_pag), thumbnail=get_thumb("next.png"), title_lista=title_lista, cnt_pag=cnt_pag))
@@ -1042,32 +929,7 @@ def findvideos(item):
verificar_enlaces_descargas = -1 #Verificar todos los enlaces Descargar
verificar_enlaces_descargas_validos = True #"¿Contar sólo enlaces 'verificados' en Descargar?"
excluir_enlaces_descargas = [] #Lista vacía de servidores excluidos en Descargar
# Saber si estamos en una ventana emergente lanzada desde una viñeta del menú principal,
# con la función "play_from_library"
unify_status = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
unify_status = config.get_setting("unify")
except:
unify_status = config.get_setting("unify")
#Salvamos la información de max num. de episodios por temporada para despues de TMDB
if item.infoLabels['temporada_num_episodios']:
num_episodios = item.infoLabels['temporada_num_episodios']
else:
num_episodios = 1
# Obtener la información actualizada del Episodio, si no la hay
if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'):
tmdb.set_infoLabels(item, __modo_grafico__)
elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary":
tmdb.set_infoLabels(item, __modo_grafico__)
#Restauramos la información de max num. de episodios por temporada despues de TMDB
if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']:
item.infoLabels['temporada_num_episodios'] = num_episodios
# Descarga la página
try:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
@@ -1081,17 +943,15 @@ def findvideos(item):
#Añadimos el tamaño para todos
size = scrapertools.find_single_match(data, '<div class="entry-left".*?><a href=".*?span class=.*?>Size:<\/strong>?\s(\d+?\.?\d*?\s\w[b|B])<\/span>')
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
if size:
item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
#Limpiamos de año y rating de episodios
if item.infoLabels['episodio_titulo']:
item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo'])
item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(item.wanted, '')
if item.infoLabels['aired'] and item.contentType == "episode":
item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})')
if not size:
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B])\]')
else:
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
@@ -1100,57 +960,29 @@ def findvideos(item):
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";'
item_local.url = scrapertools.find_single_match(data, patron)
if not item_local.url: #error
logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
#logger.debug("Patron: " + patron + " url: " + item_local.url)
#logger.debug(data)
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
rating = '' #Ponemos el rating
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
if item_local.contentType == "episode":
title = '%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
if item_local.infoLabels['temporada_num_episodios']:
title = '%s (de %s)' % (title, str(item_local.infoLabels['temporada_num_episodios']))
title = '%s %s' % (title, item_local.infoLabels['episodio_titulo'])
title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language), size)
else:
title = item_local.title
title_gen = title
title_gen = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title_gen).strip() #Quitamos etiquetas vacías
title_gen = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title_gen).strip() #Quitamos colores vacíos
title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen)
else:
title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen)
if config.get_setting("quit_channel_name", "videolibrary") == 1 and item_local.contentChannel == "videolibrary":
title_gen = '%s: %s' % (item_local.channel.capitalize(), title_gen)
itemlist.append(item_local.clone(title=title_gen)) #Título con todos los datos del vídeo
#Ahora pintamos el link del Torrent, si lo hay
if item_local.url: # Hay Torrent ?
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos etiquetas vacías
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos colores vacíos
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.server = "torrent" #Servidor
if size:
quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título
else:
quality = item_local.quality
itemlist.append(item_local.clone()) #Pintar pantalla
itemlist.append(item_local.clone(quality=quality)) #Pintar pantalla
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + title_gen + " / " + title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
#logger.debug(item_local)
# VER vídeos, descargar vídeos un link, o múltiples links
@@ -1236,7 +1068,7 @@ def findvideos(item):
if len(enlaces_descargar) > 0 and ver_enlaces_descargas != 0:
#Pintamos un pseudo-título de Descargas
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
if not item.unify: #Si Titulos Inteligentes NO seleccionados:
itemlist.append(item_local.clone(title="[COLOR gold]**- Enlaces Descargar: -**[/COLOR]", action=""))
else:
itemlist.append(item_local.clone(title="[COLOR gold] Enlaces Descargar: [/COLOR]", action=""))
@@ -1261,7 +1093,7 @@ def findvideos(item):
#Recorremos cada una de las partes. Vemos si el primer link está activo. Si no lo está ignoramos todo el enlace
p = 1
for enlace in partes:
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = "[COLOR yellow][%s][/COLOR] %s (%s/%s) [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
else:
parte_title = "[COLOR yellow]%s-[/COLOR] %s %s/%s [COLOR limegreen]-%s[/COLOR] [COLOR red]-%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
@@ -1303,12 +1135,12 @@ def findvideos(item):
break #Si se ha agotado el contador de verificación, se sale de "Enlace"
if item_local.alive == "??": #dudoso
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR yellow][?][/COLOR] %s' % (parte_title)
else:
parte_title = '[COLOR yellow]%s[/COLOR]-%s' % (item_local.alive, parte_title)
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR red][%s][/COLOR] %s' % (item_local.alive, parte_title)
else:
parte_title = '[COLOR red]%s[/COLOR]-%s' % (item_local.alive, parte_title)
@@ -1377,7 +1209,7 @@ def episodios(item):
list_pages = [item.url]
season = max_temp
if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas
if item.library_playcounts or item.tmdb_stat: #Comprobamos si realmente sabemos el num. máximo de temporadas
num_temporadas_flag = True
else:
num_temporadas_flag = False
@@ -1441,10 +1273,15 @@ def episodios(item):
if scrapertools.find_single_match(info, '\[\d{3}\]'):
info = re.sub(r'\[(\d{3}\])', r'[Cap.\1', info)
elif scrapertools.find_single_match(info, 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'):
pattern = 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'
elif scrapertools.find_single_match(info, '\[Cap.\d{2}_\d{2}\]'):
info = re.sub(r'\[Cap.(\d{2})_(\d{2})\]', r'[Cap.1\1_1\2]', info)
elif scrapertools.find_single_match(info, '\[Cap.([A-Za-z]+)\]'):
info = re.sub(r'\[Cap.([A-Za-z]+)\]', '[Cap.100]', info)
elif "completa" in info.lower():
info = info.replace("COMPLETA", "Caps. 01_99")
pattern = 'Temp.*?(?P<season>\d+).*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<quality>.*?)\].*?\[(?P<lang>\w+)\]?'
if scrapertools.find_single_match(info, '\[Cap.\d{2,3}'):
pattern = "\[(?P<quality>.*?)\].*?\[Cap.(?P<season>\d).*?(?P<episode>\d{2})(?:_(?P<season2>\d+)" \
"(?P<episode2>\d{2}))?.*?\].*?(?:\[(?P<lang>.*?)\])?"
@@ -1475,15 +1312,18 @@ def episodios(item):
except:
logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / " + str(match['episode2']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
if num_temporadas_flag and match['season'] != season and match['season'] > max_temp + 1:
#Si el num de temporada está fuera de control, se trata pone en num. de temporada actual
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
match['season'] = season
item_local.contentSeason = season
else:
item_local.contentSeason = match['season']
season = match['season']
num_temporadas_flag = True
if match['episode'] > 0:
num_temporadas_flag = True
if season > max_temp:
max_temp = season
@@ -1496,12 +1336,13 @@ def episodios(item):
item_local.infoLabels['episodio_titulo'] = match['lang']
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.contentEpisodeNumber = match['episode']
if match['episode'] == 0: match['episode'] = 1 #Evitar errores en Videoteca
if match["episode2"]: #Hay episodio dos? es una entrada múltiple?
item_local.title = "%sx%s al %s -" % (str(match["season"]), str(match["episode"]).zfill(2), str(match["episode2"]).zfill(2)) #Creamos un título con el rango de episodios
else: #Si es un solo episodio, se formatea ya
item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2))
item_local.contentEpisodeNumber = match['episode']
if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca
if item_local.contentSeason < max_temp:
@@ -1541,92 +1382,23 @@ def episodios(item):
# Pasada por TMDB y clasificación de lista por temporada y episodio
tmdb.set_infoLabels(itemlist, True)
# Pasada para maqullaje de los títulos obtenidos desde TMDB
num_episodios = 1
num_episodios_lista = []
for i in range(0, 50): num_episodios_lista += [0]
num_temporada = 1
num_temporada_max = 99
num_episodios_flag = True
for item_local in itemlist:
# Si no hay datos de TMDB, pongo los datos locales que conozco
if item_local.infoLabels['aired']:
item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Salvamos en número de episodios de la temporada
if item_local.infoLabels['number_of_seasons']:
#Si el num de temporada está fuera de control, se pone 0, y se reclasifica itemlist
if item_local.contentSeason > item_local.infoLabels['number_of_seasons'] + 1:
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(item_local.infoLabels['number_of_seasons']) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
else:
num_temporada_max = item_local.infoLabels['number_of_seasons']
else:
if item_local.contentSeason > num_temporada_max + 1:
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))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
if num_temporada != item_local.contentSeason:
num_temporada = item_local.contentSeason
num_episodios = 0
if item_local.infoLabels['temporada_num_episodios']:
num_episodios = item_local.infoLabels['temporada_num_episodios']
#Preparamos el título para que sea compatible con Añadir Serie a Videoteca
if item_local.infoLabels['episodio_titulo']:
if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName)
else:
item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo'])
if item_local.infoLabels['year']:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'])
if rating:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating)
else:
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating)
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language))
#Quitamos campos vacíos
item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "").strip()
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
if num_episodios < item_local.contentEpisodeNumber:
num_episodios = item_local.contentEpisodeNumber
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
item_local.infoLabels['temporada_num_episodios'] = num_episodios
num_episodios_flag = False
num_episodios_lista[item_local.contentSeason] = [num_episodios]
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
#logger.debug(item_local)
try:
if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie
for item_local in itemlist:
item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason]
except:
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))
if config.get_videolibrary_support() and len(itemlist) > 0:
title = ''
if item_local.infoLabels['temporada_num_episodios']:
title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios']
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]" + title, action="add_serie_to_library", extra="episodios"))
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
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 launcher.run(item)
def search(item, texto):
logger.info("search:" + texto)
+29 -228
View File
@@ -12,6 +12,7 @@ from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
from lib import generictools
host = "https://grantorrent.net/"
@@ -320,46 +321,8 @@ def listado(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season":
item_local.contentTitle= ''
if scrapertools.find_single_match(item_local.url, '-(\d+)x'):
title = '%s -Temporada %s' % (title, scrapertools.find_single_match(item_local.url, '-(\d+)x'))
if scrapertools.find_single_match(item_local.url, '-temporadas?-(\d+)'):
title = '%s -Temporada %s' % (title, scrapertools.find_single_match(item_local.url, '-temporadas?-(\d+)'))
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteligentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
item_local.title = title
#logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + "[" + str(item_local.language) + "]" + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
#Gestionamos el paginador
patron = '<div class="nav-links">.*?<a class="next page.*?href="(.*?)"'
@@ -384,39 +347,7 @@ def listado(item):
def findvideos(item):
logger.info()
itemlist = []
# Saber si estamos en una ventana emergente lanzada desde una viñeta del menú principal,
# con la función "play_from_library"
unify_status = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
unify_status = config.get_setting("unify")
except:
unify_status = config.get_setting("unify")
#Salvamos la información de max num. de episodios por temporada para despues de TMDB
if item.infoLabels['temporada_num_episodios']:
num_episodios = item.infoLabels['temporada_num_episodios']
else:
num_episodios = 1
# Obtener la información actualizada del Episodio, si no la hay
if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'):
tmdb.set_infoLabels(item, __modo_grafico__)
elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary":
tmdb.set_infoLabels(item, __modo_grafico__)
#Restauramos la información de max num. de episodios por temporada despues de TMDB
if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']:
item.infoLabels['temporada_num_episodios'] = num_episodios
#Limpiamos de año y rating de episodios
if item.infoLabels['episodio_titulo']:
item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo'])
item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(' - ' + item.contentSerieName, '')
if item.infoLabels['aired'] and item.contentType == "episode":
item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})')
#Bajamos los datos de la página
try:
data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data)
@@ -430,53 +361,16 @@ def findvideos(item):
patron = '\/icono_.*?png" title="(?P<lang>.*?)?" [^>]+><\/td><td>(?P<quality>.*?)?<?\/td>.*?<td>(?P<size>.*?)?<\/td><td><a class="link" href="(?P<url>.*?)?"'
matches = re.compile(patron, re.DOTALL).findall(data)
if not matches: #error
logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
#logger.debug("PATRON: " + patron)
#logger.debug(matches)
#logger.debug(data)
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
rating = '' #Ponemos el rating
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
if item_local.contentType == "episode":
title = '%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
if item_local.infoLabels['temporada_num_episodios']:
title = '%s (de %s)' % (title, str(item_local.infoLabels['temporada_num_episodios']))
title = '%s %s' % (title, item_local.infoLabels['episodio_titulo'])
title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR red]%s[/COLOR]' % (title, item_local.contentSerieName, item_local.infoLabels['year'], rating, str(item_local.language))
else:
title = item_local.contentTitle
title_gen = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR red]%s[/COLOR]' % (title, item_local.infoLabels['year'], rating, str(item_local.language))
title_gen = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title_gen).strip() #Quitamos etiquetas vacías
title_gen = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title_gen).strip() #Quitamos colores vacíos
title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen)
else:
title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen)
if config.get_setting("quit_channel_name", "videolibrary") == 1 and item_local.contentChannel == "videolibrary":
title_gen = '%s: %s' % (item_local.channel.capitalize(), title_gen)
itemlist.append(item_local.clone(title=title_gen)) #Título con todos los datos del vídeo
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
#Ahora recorremos todos los links por calidades
for lang, quality, size, scrapedurl in matches:
@@ -552,7 +446,7 @@ def findvideos(item):
itemlist.append(item_local.clone()) #Pintar pantalla
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + title_gen + " / " + title + " / calidad: " + item_local.quality)
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality)
#logger.debug(item_local)
return itemlist
@@ -805,7 +699,7 @@ def episodios(item):
item_local.language[0:0] = ["DUAL"]
try:
if "temporada" in temp_epi.lower(): #si es una temporada en vez de un episodio, lo aceptamos como episodio 1
if "temporada" in temp_epi.lower() or "completa" in temp_epi.lower(): #si es una temporada en vez de un episodio, lo aceptamos como episodio 1
item_local.contentSeason = scrapertools.find_single_match(temp_epi, r'[t|T]emporada.*?(\d+)')
if not item_local.contentSeason:
item_local.contentSeason = temp_actual_num
@@ -833,14 +727,15 @@ def episodios(item):
if "-" in temp_epi: #episodios múltiples
episode2 = scrapertools.find_single_match(temp_epi, r'-(\d+)')
item_local.title = "%sx%s al %s -" % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2), str(episode2).zfill(2)) #Creamos un título con el rango de episodios
elif "temporada" in temp_epi.lower(): #Temporada completa
item_local.title = '%sx%s - Temporada %s Completa -' % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2), item_local.contentSeason)
elif "temporada" in temp_epi.lower() or "completa" in temp_epi.lower(): #Temporada completa
episode2 = 99
item_local.title = "%sx%s al %s -" % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2), str(episode2).zfill(2)) #Creamos un título con el rango ficticio de episodios
elif item_local.contentEpisodeNumber == 0: #episodio extraño
item_local.title = '%sx%s - %s' % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2), temp_epi)
else: #episodio normal
item_local.title = '%sx%s -' % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2))
if len(itemlist) > 0 and item_local.contentSeason == itemlist[-1].contentSeason and item_local.contentEpisodeNumber == itemlist[-1].contentEpisodeNumber and not "Temporada" in itemlist[-1].title and itemlist[-1].contentEpisodeNumber != 0: #solo guardamos un episodio ...
if len(itemlist) > 0 and item_local.contentSeason == itemlist[-1].contentSeason and item_local.contentEpisodeNumber == itemlist[-1].contentEpisodeNumber and item_local.title == itemlist[-1].title and itemlist[-1].contentEpisodeNumber != 0: #solo guardamos un episodio ...
if itemlist[-1].quality:
itemlist[-1].quality += ", " + quality #... pero acumulamos las calidades
else:
@@ -864,126 +759,32 @@ def episodios(item):
data = '' #Limpiamos data para forzar la lectura en la próxima pasada
item.contentSeason_save = contentSeason #Guardamos temporalemente este contador
if len(itemlist) > 1:
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos
# Pasada por TMDB y clasificación de lista por temporada y episodio
tmdb.set_infoLabels(itemlist, True)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
num_episodios = 1
num_episodios_lista = []
for i in range(0, 50): num_episodios_lista += [0]
num_temporada = 1
num_temporada_max = 99
num_episodios_flag = True
for item_local in itemlist:
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
# Si no hay datos de TMDB, pongo los datos locales que conozco
if item_local.infoLabels['aired']:
item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Salvamos en número de episodios de la temporada
if item_local.infoLabels['number_of_seasons']:
#Si el num de temporada está fuera de control, se pone 0, y se reclasifica itemlist
if item_local.contentSeason > item_local.infoLabels['number_of_seasons'] + 1:
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(item_local.infoLabels['number_of_seasons']) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
else:
num_temporada_max = item_local.infoLabels['number_of_seasons']
else:
if item_local.contentSeason > num_temporada_max + 1:
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))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
if num_temporada != item_local.contentSeason:
num_temporada = item_local.contentSeason
num_episodios = 0
if item_local.infoLabels['temporada_num_episodios']:
num_episodios = item_local.infoLabels['temporada_num_episodios']
#Preparamos el título para que sea compatible con Añadir Serie a Videoteca
if item_local.infoLabels['episodio_titulo'] and not "Temporada" in item_local.title:
if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName)
else:
item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo'])
if item_local.infoLabels['year']:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'])
if rating:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating)
else:
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
if "Temporada" in item_local.title:
item_local.infoLabels['episodio_titulo'] = '%s - %s [%s] [%s]' % (scrapertools.find_single_match(item_local.title, r'(Temporada \d+ Completa)'), item_local.contentSerieName, item_local.infoLabels['year'], rating)
else:
item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating)
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language))
#Quitamos campos vacíos
item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "").strip()
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
#logger.debug(str(num_episodios) + " / " + str(item_local.contentEpisodeNumber) + " / " + str(item_local.infoLabels['temporada_num_episodios']) + str(num_episodios_lista))
if num_episodios < item_local.contentEpisodeNumber:
num_episodios = item_local.contentEpisodeNumber
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
item_local.infoLabels['temporada_num_episodios'] = num_episodios
num_episodios_flag = False
num_episodios_lista[item_local.contentSeason] = [num_episodios]
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
#logger.debug(item_local)
try:
if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie
for item_local in itemlist:
item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason]
except:
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))
if config.get_videolibrary_support() and len(itemlist) > 0:
title = ''
if item_local.infoLabels['temporada_num_episodios']:
title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios']
if item_local.quality: #La Videoteca no toma la calidad del episodio, sino de la serie. Pongo del episodio
item.quality = item_local.quality
if item.action == 'get_seasons': #si es actualización de videoteca, título estándar
#Si hay una nueva Temporada, se activa como la actual
if item.library_urls[item.channel] != item.url and (item.contentType == "season" or modo_ultima_temp):
item.library_urls[item.channel] = item.url #Se actualiza la url apuntando a la última Temporada
try:
from core import videolibrarytools #Se fuerza la actualización de la url en el .nfo
itemlist_fake = [] #Se crea un Itemlist vacio para actualizar solo el .nfo
videolibrarytools.save_tvshow(item, itemlist_fake) #Se actualiza el .nfo
except:
logger.error("ERROR 08: EPISODIOS: No se ha podido actualizar la URL a la nueva Temporada")
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta Serie a la Videoteca[/COLOR]" + title, action="add_serie_to_library"))
elif modo_serie_temp == 1: #si es Serie damos la opción de guardar la última temporada o la serie completa
itemlist.append(item.clone(title="[COLOR yellow]Añadir última Temp. a Videoteca[/COLOR]" + title, action="add_serie_to_library", contentType="season", contentSeason=contentSeason, url=item_local.url))
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta Serie a Videoteca[/COLOR]" + title, action="add_serie_to_library", contentType="tvshow"))
else: #si no, damos la opción de guardar la temporada actual o la serie completa
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta Serie a Videoteca[/COLOR]" + title, action="add_serie_to_library", contentType="tvshow"))
item.contentSeason = contentSeason
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta Temp. a Videoteca[/COLOR]" + title, action="add_serie_to_library", contentType="season", contentSeason=contentSeason))
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 launcher.run(item)
def search(item, texto):
logger.info("texto:" + texto)
texto = texto.replace(" ", "+")
+6 -4
View File
@@ -35,6 +35,8 @@ def login(pagina):
dom = pagina.split(".")[0]
user = config.get_setting("%suser" %dom, "kbagi")
password = config.get_setting("%spassword" %dom, "kbagi")
if "kbagi" in pagina:
pagina = "k-bagi.com"
if not user:
return False, "Para ver los enlaces de %s es necesario registrarse en %s" %(dom, pagina)
data = httptools.downloadpage("http://%s" % pagina).data
@@ -65,14 +67,14 @@ def mainlist(item):
if not logueado:
itemlist.append(item.clone(title=error_message, action="configuracion", folder=False))
else:
item.extra = "http://kbagi.com"
item.extra = "http://k-bagi.com"
itemlist.append(item.clone(title="kbagi", action="", text_color=color2))
itemlist.append(
item.clone(title=" Búsqueda", action="search", url="http://kbagi.com/action/SearchFiles"))
item.clone(title=" Búsqueda", action="search", url="http://k-bagi.com/action/SearchFiles"))
itemlist.append(item.clone(title=" Colecciones", action="colecciones",
url="http://kbagi.com/action/home/MoreNewestCollections?pageNumber=1"))
url="http://k-bagi.com/action/home/MoreNewestCollections?pageNumber=1"))
itemlist.append(item.clone(title=" Búsqueda personalizada", action="filtro",
url="http://kbagi.com/action/SearchFiles"))
url="http://k-bagi.com/action/SearchFiles"))
itemlist.append(item.clone(title=" Mi cuenta", action="cuenta"))
logueado, error_message = login("diskokosmiko.mx")
if not logueado:
+68 -296
View File
@@ -4,6 +4,7 @@ import re
import sys
import urllib
import urlparse
import datetime
from channelselector import get_thumb
from core import httptools
@@ -12,6 +13,7 @@ from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
from lib import generictools
host = 'http://mispelisyseries.com/'
@@ -145,11 +147,7 @@ def listado(item):
clase = "pelilist" # etiqueta para localizar zona de listado de contenidos
url_next_page ='' # Controlde paginación
cnt_tot = 30 # Poner el num. máximo de items por página
category = "" # Guarda la categoria que viene desde una busqueda global
if item.category:
category = item.category
del item.category
if item.totalItems:
del item.totalItems
@@ -258,8 +256,10 @@ def listado(item):
del item_local.tipo
if item_local.totalItems:
del item_local.totalItems
if item.post_num:
del item.post_num
if item_local.post_num:
del item_local.post_num
if item_local.category:
del item_local.category
item_local.title = ''
item_local.context = "['buscar_trailer']"
@@ -336,8 +336,8 @@ def listado(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("Espa", "").replace("Ingl", "").replace("Engl", "").replace("Calidad", "").replace("de la Serie", "")
title_alt = title_alt.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Espa", "").replace("Ingl", "").replace("Engl", "").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", "")
title_alt = title_alt.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)
@@ -347,7 +347,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -403,65 +403,8 @@ def listado(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
if category == "newest": #Viene de Novedades. Marquemos el título con el nombre del canal
title += ' -%s-' % item_local.channel.capitalize()
if item_local.contentType == "movie":
item_local.contentTitle += ' -%s-' % item_local.channel.capitalize()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if len(itemlist) == 0:
itemlist.append(Item(channel=item.channel, action="mainlist", title="No se ha podido cargar el listado"))
@@ -728,7 +671,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("Esp", "").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("Ing", "").replace("Eng", "").replace("Calidad", "").replace("de la Serie", "")
#Limpiamos cabeceras y colas del título
title = re.sub(r'Descargar\s\w+\-\w+', '', title)
@@ -738,7 +681,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -868,64 +811,8 @@ def listado_busqueda(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
title += " -Serie-"
elif item_local.extra == "varios":
title += " -Varios-"
item_local.contentTitle += " -Varios-"
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + "[" + str(item_local.language) + "]" + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if post:
itemlist.append(item.clone(channel=item.channel, action="listado_busqueda", title="[COLOR gold][B]Pagina siguiente >> [/B][/COLOR]" + str(post_num) + " de " + str(total_pag), thumbnail=get_thumb("next.png"), title_lista=title_lista, cnt_pag=cnt_pag))
@@ -1042,32 +929,7 @@ def findvideos(item):
verificar_enlaces_descargas = -1 #Verificar todos los enlaces Descargar
verificar_enlaces_descargas_validos = True #"¿Contar sólo enlaces 'verificados' en Descargar?"
excluir_enlaces_descargas = [] #Lista vacía de servidores excluidos en Descargar
# Saber si estamos en una ventana emergente lanzada desde una viñeta del menú principal,
# con la función "play_from_library"
unify_status = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
unify_status = config.get_setting("unify")
except:
unify_status = config.get_setting("unify")
#Salvamos la información de max num. de episodios por temporada para despues de TMDB
if item.infoLabels['temporada_num_episodios']:
num_episodios = item.infoLabels['temporada_num_episodios']
else:
num_episodios = 1
# Obtener la información actualizada del Episodio, si no la hay
if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'):
tmdb.set_infoLabels(item, __modo_grafico__)
elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary":
tmdb.set_infoLabels(item, __modo_grafico__)
#Restauramos la información de max num. de episodios por temporada despues de TMDB
if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']:
item.infoLabels['temporada_num_episodios'] = num_episodios
# Descarga la página
try:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
@@ -1081,17 +943,15 @@ def findvideos(item):
#Añadimos el tamaño para todos
size = scrapertools.find_single_match(data, '<div class="entry-left".*?><a href=".*?span class=.*?>Size:<\/strong>?\s(\d+?\.?\d*?\s\w[b|B])<\/span>')
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
if size:
item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
#Limpiamos de año y rating de episodios
if item.infoLabels['episodio_titulo']:
item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo'])
item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(item.wanted, '')
if item.infoLabels['aired'] and item.contentType == "episode":
item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})')
if not size:
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B])\]')
else:
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
@@ -1100,57 +960,29 @@ def findvideos(item):
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";'
item_local.url = scrapertools.find_single_match(data, patron)
if not item_local.url: #error
logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
#logger.debug("Patron: " + patron + " url: " + item_local.url)
#logger.debug(data)
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
rating = '' #Ponemos el rating
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
if item_local.contentType == "episode":
title = '%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
if item_local.infoLabels['temporada_num_episodios']:
title = '%s (de %s)' % (title, str(item_local.infoLabels['temporada_num_episodios']))
title = '%s %s' % (title, item_local.infoLabels['episodio_titulo'])
title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language), size)
else:
title = item_local.title
title_gen = title
title_gen = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title_gen).strip() #Quitamos etiquetas vacías
title_gen = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title_gen).strip() #Quitamos colores vacíos
title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen)
else:
title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen)
if config.get_setting("quit_channel_name", "videolibrary") == 1 and item_local.contentChannel == "videolibrary":
title_gen = '%s: %s' % (item_local.channel.capitalize(), title_gen)
itemlist.append(item_local.clone(title=title_gen)) #Título con todos los datos del vídeo
#Ahora pintamos el link del Torrent, si lo hay
if item_local.url: # Hay Torrent ?
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos etiquetas vacías
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos colores vacíos
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.server = "torrent" #Servidor
if size:
quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título
else:
quality = item_local.quality
itemlist.append(item_local.clone()) #Pintar pantalla
itemlist.append(item_local.clone(quality=quality)) #Pintar pantalla
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + title_gen + " / " + title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
#logger.debug(item_local)
# VER vídeos, descargar vídeos un link, o múltiples links
@@ -1236,7 +1068,7 @@ def findvideos(item):
if len(enlaces_descargar) > 0 and ver_enlaces_descargas != 0:
#Pintamos un pseudo-título de Descargas
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
if not item.unify: #Si Titulos Inteligentes NO seleccionados:
itemlist.append(item_local.clone(title="[COLOR gold]**- Enlaces Descargar: -**[/COLOR]", action=""))
else:
itemlist.append(item_local.clone(title="[COLOR gold] Enlaces Descargar: [/COLOR]", action=""))
@@ -1261,7 +1093,7 @@ def findvideos(item):
#Recorremos cada una de las partes. Vemos si el primer link está activo. Si no lo está ignoramos todo el enlace
p = 1
for enlace in partes:
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = "[COLOR yellow][%s][/COLOR] %s (%s/%s) [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
else:
parte_title = "[COLOR yellow]%s-[/COLOR] %s %s/%s [COLOR limegreen]-%s[/COLOR] [COLOR red]-%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
@@ -1303,12 +1135,12 @@ def findvideos(item):
break #Si se ha agotado el contador de verificación, se sale de "Enlace"
if item_local.alive == "??": #dudoso
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR yellow][?][/COLOR] %s' % (parte_title)
else:
parte_title = '[COLOR yellow]%s[/COLOR]-%s' % (item_local.alive, parte_title)
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR red][%s][/COLOR] %s' % (item_local.alive, parte_title)
else:
parte_title = '[COLOR red]%s[/COLOR]-%s' % (item_local.alive, parte_title)
@@ -1377,7 +1209,7 @@ def episodios(item):
list_pages = [item.url]
season = max_temp
if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas
if item.library_playcounts or item.tmdb_stat: #Comprobamos si realmente sabemos el num. máximo de temporadas
num_temporadas_flag = True
else:
num_temporadas_flag = False
@@ -1441,10 +1273,15 @@ def episodios(item):
if scrapertools.find_single_match(info, '\[\d{3}\]'):
info = re.sub(r'\[(\d{3}\])', r'[Cap.\1', info)
elif scrapertools.find_single_match(info, 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'):
pattern = 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'
elif scrapertools.find_single_match(info, '\[Cap.\d{2}_\d{2}\]'):
info = re.sub(r'\[Cap.(\d{2})_(\d{2})\]', r'[Cap.1\1_1\2]', info)
elif scrapertools.find_single_match(info, '\[Cap.([A-Za-z]+)\]'):
info = re.sub(r'\[Cap.([A-Za-z]+)\]', '[Cap.100]', info)
elif "completa" in info.lower():
info = info.replace("COMPLETA", "Caps. 01_99")
pattern = 'Temp.*?(?P<season>\d+).*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<quality>.*?)\].*?\[(?P<lang>\w+)\]?'
if scrapertools.find_single_match(info, '\[Cap.\d{2,3}'):
pattern = "\[(?P<quality>.*?)\].*?\[Cap.(?P<season>\d).*?(?P<episode>\d{2})(?:_(?P<season2>\d+)" \
"(?P<episode2>\d{2}))?.*?\].*?(?:\[(?P<lang>.*?)\])?"
@@ -1475,15 +1312,18 @@ def episodios(item):
except:
logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / " + str(match['episode2']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
if num_temporadas_flag and match['season'] != season and match['season'] > max_temp + 1:
#Si el num de temporada está fuera de control, se trata pone en num. de temporada actual
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
match['season'] = season
item_local.contentSeason = season
else:
item_local.contentSeason = match['season']
season = match['season']
num_temporadas_flag = True
if match['episode'] > 0:
num_temporadas_flag = True
if season > max_temp:
max_temp = season
@@ -1496,12 +1336,13 @@ def episodios(item):
item_local.infoLabels['episodio_titulo'] = match['lang']
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.contentEpisodeNumber = match['episode']
if match['episode'] == 0: match['episode'] = 1 #Evitar errores en Videoteca
if match["episode2"]: #Hay episodio dos? es una entrada múltiple?
item_local.title = "%sx%s al %s -" % (str(match["season"]), str(match["episode"]).zfill(2), str(match["episode2"]).zfill(2)) #Creamos un título con el rango de episodios
else: #Si es un solo episodio, se formatea ya
item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2))
item_local.contentEpisodeNumber = match['episode']
if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca
if item_local.contentSeason < max_temp:
@@ -1541,92 +1382,23 @@ def episodios(item):
# Pasada por TMDB y clasificación de lista por temporada y episodio
tmdb.set_infoLabels(itemlist, True)
# Pasada para maqullaje de los títulos obtenidos desde TMDB
num_episodios = 1
num_episodios_lista = []
for i in range(0, 50): num_episodios_lista += [0]
num_temporada = 1
num_temporada_max = 99
num_episodios_flag = True
for item_local in itemlist:
# Si no hay datos de TMDB, pongo los datos locales que conozco
if item_local.infoLabels['aired']:
item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Salvamos en número de episodios de la temporada
if item_local.infoLabels['number_of_seasons']:
#Si el num de temporada está fuera de control, se pone 0, y se reclasifica itemlist
if item_local.contentSeason > item_local.infoLabels['number_of_seasons'] + 1:
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(item_local.infoLabels['number_of_seasons']) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
else:
num_temporada_max = item_local.infoLabels['number_of_seasons']
else:
if item_local.contentSeason > num_temporada_max + 1:
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))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
if num_temporada != item_local.contentSeason:
num_temporada = item_local.contentSeason
num_episodios = 0
if item_local.infoLabels['temporada_num_episodios']:
num_episodios = item_local.infoLabels['temporada_num_episodios']
#Preparamos el título para que sea compatible con Añadir Serie a Videoteca
if item_local.infoLabels['episodio_titulo']:
if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName)
else:
item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo'])
if item_local.infoLabels['year']:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'])
if rating:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating)
else:
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating)
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language))
#Quitamos campos vacíos
item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "").strip()
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
if num_episodios < item_local.contentEpisodeNumber:
num_episodios = item_local.contentEpisodeNumber
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
item_local.infoLabels['temporada_num_episodios'] = num_episodios
num_episodios_flag = False
num_episodios_lista[item_local.contentSeason] = [num_episodios]
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
#logger.debug(item_local)
try:
if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie
for item_local in itemlist:
item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason]
except:
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))
if config.get_videolibrary_support() and len(itemlist) > 0:
title = ''
if item_local.infoLabels['temporada_num_episodios']:
title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios']
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]" + title, action="add_serie_to_library", extra="episodios"))
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
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 launcher.run(item)
def search(item, texto):
logger.info("search:" + texto)
+57 -38
View File
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import re
import urlparse
@@ -17,33 +17,33 @@ def mainlist(item):
itemlist = list()
itemlist.append(
Item(channel=item.channel, action="lista", title="Top Películas", url=urlparse.urljoin(host, "top")))
itemlist.append(Item(channel=item.channel, action="lista", title="Novedades", url=host))
#itemlist.append(
# Item(channel=item.channel, action="lista", title="Top Películas", url=urlparse.urljoin(host, "top")))
#itemlist.append(Item(channel=item.channel, action="lista", title="Novedades", url=host))
itemlist.append(Item(channel=item.channel, action="explorar", title="Género", url=urlparse.urljoin(host, "genero")))
itemlist.append(Item(channel=item.channel, action="explorar", title="Listado Alfabético",
url=urlparse.urljoin(host, "alfabetico")))
# itemlist.append(Item(channel=item.channel, action="explorar", title="Listado por año", url=urlparse.urljoin(host, "año")))
itemlist.append(Item(channel=item.channel, action="lista", title="Otras Películas (No Bollywood)",
url=urlparse.urljoin(host, "estrenos")))
itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=urlparse.urljoin(host, "buscar-")))
#itemlist.append(Item(channel=item.channel, action="explorar", title="Listado Alfabético",
# url=urlparse.urljoin(host, "alfabetico")))
itemlist.append(Item(channel=item.channel, action="explorar", title="Listado por Año", url=urlparse.urljoin(host, "genero")))
#itemlist.append(Item(channel=item.channel, action="lista", title="Otras Películas (No Bollywood)",
# url=urlparse.urljoin(host, "estrenos")))
#itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=urlparse.urljoin(host, "buscar-")))
return itemlist
def explorar(item):
logger.info()
itemlist = list()
url1 = item.title
data = httptools.downloadpage(host).data
urltitle = item.title
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
if 'Género' in url1:
patron = '<div class="d">.+?<h3>Pel.+?neros<\/h3>(.+?)<\/h3>'
if 'Listado Alfabético' in url1:
patron = '<\/li><\/ul>.+?<h3>Pel.+?tico<\/h3>(.+?)<\/h3>'
if 'Año' in url1:
patron = '<ul class="anio"><li>(.+?)<\/ul>'
if 'Género' in urltitle:
patron = "var accion = '<div .+?>(.+?)<\/div>'"
#if 'Listado Alfabético' in urltitle:
# patron = '<\/li><\/ul>.+?<h3>Pel.+?tico<\/h3>(.+?)<\/h3>'
if 'Año' in urltitle:
patron = "var anho = '<div .+?>(.+?)<\/div>'"
data_explorar = scrapertools.find_single_match(data, patron)
patron_explorar = '<a href="([^"]+)">([^"]+)<\/a>'
patron_explorar = '<li class=".+?"><a class=".+?" href="(.+?)">(.+?)<\/a><\/li>'
matches = scrapertools.find_multiple_matches(data_explorar, patron_explorar)
for scrapedurl, scrapedtitle in matches:
if 'Acci' in scrapedtitle:
@@ -56,7 +56,9 @@ def explorar(item):
scrapedtitle = 'Histórico'
if 'lico Guerra' in scrapedtitle:
scrapedtitle = 'Bélico Guerra'
if 'Ciencia' in scrapedtitle:
if 'Biogra' in scrapedtitle:
scrapedtitle = 'Biografía'
if 'Ficcion' in scrapedtitle:
scrapedtitle = 'Ciencia Ficción'
itemlist.append(item.clone(action='lista', title=scrapedtitle, url=scrapedurl))
return itemlist
@@ -78,17 +80,22 @@ def lista(item):
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data) # Eliminamos tabuladores, dobles espacios saltos de linea, etc...
data_mov= scrapertools.find_single_match(data,'<div id="cuerpo"><div class="iz">(.+)<ul class="pag">')
patron = '<a href="([^"]+)"><img src="([^"]+)" alt="([^"]+)"' # scrapedurl, scrapedthumbnail, scrapedtitle
data_mov= scrapertools.find_single_match(data,'<div class="lista-anime">(.+?)<section class="paginacion">')
patron = "<figure class='figure-peliculas'>" #generico
patron += " <a href='(.+?)' .+?>.+?" #scrapedurl
patron += "<img .+? src=(.+?) alt.+?> " #scrapedthumbnail
patron += "<p>(.+?)<\/p>.+?" #scrapedplot
patron += "<p class='.+?anho'>(.+?)" #scrapedyear
patron += "<\/p>.+?<h2>(.+?)<\/h2>" #scrapedtitle
matches = scrapertools.find_multiple_matches(data_mov, patron)
for scrapedurl, scrapedthumbnail, scrapedtitle in matches: # scrapedthumbnail, scrapedtitle in matches:
itemlist.append(item.clone(title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, action="findvideos",
for scrapedurl, scrapedthumbnail, scrapedplot, scrapedyear, scrapedtitle in matches:
if '"' in scrapedthumbnail:
scrapedthumbnail=scrapedthumbnail.replace('"','')
itemlist.append(item.clone(title=scrapedtitle+' ['+scrapedyear+']', url=scrapedurl, plot=scrapedplot, thumbnail=scrapedthumbnail, action="opcion",
show=scrapedtitle))
# Paginacion
patron_pag = '<a href="([^"]+)" title="Siguiente .+?">'
paginasig = scrapertools.find_single_match(data, patron_pag)
logger.info("algoooosadf "+paginasig)
next_page_url = host + paginasig
if paginasig != "":
@@ -97,23 +104,35 @@ def lista(item):
thumbnail='https://s32.postimg.cc/4zppxf5j9/siguiente.png'))
return itemlist
def findvideos(item):
def opcion(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
itemlist.extend(servertools.find_video_items(data=data))
logger.info("holaa" + data)
patron_show = '<strong>Ver Pel.+?a([^<]+) online<\/strong>'
show = scrapertools.find_single_match(data, patron_show)
for videoitem in itemlist:
videoitem.channel = item.channel
if config.get_videolibrary_support() and len(itemlist) > 0 and item.contentChannel!='videolibrary':
itemlist.append(
Item(channel=item.channel, title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url,
action="add_pelicula_to_library", extra="findvideos", contentTitle=show))
logger.info("inflos"+data)
patron = '<\/div> <\/div> <a href="(.+?)" class="a-play-cartelera"'
scrapedurl = scrapertools.find_single_match(data, patron)
#for scrapedurl in match:
itemlist.append(item.clone(url=host+scrapedurl, action="findvideos"))
return itemlist
# #def findvideos(item):
# logger.info()
# itemlist = []
# data = httptools.downloadpage(item.url).data
# data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
# itemlist.extend(servertools.find_video_items(data=data))
# patron_show = '<strong>Ver Pel.+?a([^<]+) online<\/strong>'
# show = scrapertools.find_single_match(data, patron_show)
# for videoitem in itemlist:
# videoitem.channel = item.channel
# if config.get_videolibrary_support() and len(itemlist) > 0 and item.contentChannel!='videolibrary':
# itemlist.append(
# Item(channel=item.channel, title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url,
# action="add_pelicula_to_library", extra="findvideos", contentTitle=show))
# return itemlist
+7 -1
View File
@@ -74,7 +74,11 @@ def menu_alf(item):
for letra in ['[0-9]', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']:
itemlist.append(Item(channel=item.channel, action="series", title=letra,
if 'series' in item.url:
action = 'series'
else:
action = 'pelis'
itemlist.append(Item(channel=item.channel, action=action, title=letra,
url=item.url + "?keywords=^" + letra + "&page=0"))
return itemlist
@@ -117,6 +121,7 @@ def series(item):
data = httptools.downloadpage(item.url).data
lista = jsontools.load(data)
logger.debug(lista)
if item.extra == "next":
lista_ = lista[25:]
else:
@@ -171,6 +176,7 @@ def episodios(item):
# post = "page=%s&x=34&y=14" % urllib.quote(item.url)
# response = httptools.downloadpage(url, post, follow_redirects=False).data
# url = scrapertools.find_single_match(response, '<meta http-equiv="refresh".*?url=([^"]+)"')
logger.debug(item)
data = httptools.downloadpage(item.url).data
data = jsontools.load(data)
+234 -207
View File
@@ -9,274 +9,301 @@ from platformcode import config, logger
__perfil__ = int(config.get_setting('perfil', 'pelisultra'))
# Fijar perfil de color
perfil = [['0xFFFFE6CC', '0xFFFFCE9C', '0xFF994D00'],
['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E'],
perfil = [['0xFFFFE6CC', '0xFFFFCE9C', '0xFF994D00'], ['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E'],
['0xFF58D3F7', '0xFF2E9AFE', '0xFF2E64FE']]
if __perfil__ < 3:
color1, color2, color3 = perfil[__perfil__]
color1, color2, color3 = perfil[__perfil__]
else:
color1 = color2 = color3 = ""
color1 = color2 = color3 = ""
host = "http://www.pelisultra.com"
host="http://www.pelisultra.com"
def mainlist(item):
logger.info()
itemlist = []
item.thumbnail = "https://github.com/master-1970/resources/raw/master/images/genres/0/Directors%20Chair.png"
itemlist.append(item.clone(title="Películas:", folder=False, text_color="0xFFD4AF37", text_bold=True))
itemlist.append(Item(channel = item.channel, title = " Novedades", action = "peliculas", url = host))
itemlist.append(Item(channel = item.channel, title = " Estrenos", action = "peliculas", url = host + "/genero/estrenos/" ))
itemlist.append(Item(channel = item.channel, title = " Por género", action = "genero", url = host + "/genero/" ))
item.thumbnail = "https://github.com/master-1970/resources/raw/master/images/genres/0/TV%20Series.png"
itemlist.append(item.clone(title="Series:", folder=False, text_color="0xFFD4AF37", text_bold=True))
itemlist.append(Item(channel = item.channel, title = " Todas las series", action = "series", url = host + "/series/" ))
itemlist.append(Item(channel = item.channel, title = " Nuevos episodios", action = "nuevos_episodios", url = host + "/episodio/" ))
itemlist.append(Item(channel = item.channel, title = "Buscar...", action = "search", url = host, text_color="red", text_bold=True))
itemlist.append(item.clone(title="Configurar canal...", text_color="green", action="configuracion", text_bold=True))
return itemlist
logger.info()
itemlist = []
item.thumbnail = "https://github.com/master-1970/resources/raw/master/images/genres/0/Directors%20Chair.png"
itemlist.append(item.clone(title="Películas:", folder=False, text_color="0xFFD4AF37", text_bold=True))
itemlist.append(Item(channel=item.channel, title=" Novedades", action="peliculas", url=host))
itemlist.append(
Item(channel=item.channel, title=" Estrenos", action="peliculas", url=host + "/genero/estrenos/"))
itemlist.append(Item(channel=item.channel, title=" Por género", action="genero", url=host))
item.thumbnail = "https://github.com/master-1970/resources/raw/master/images/genres/0/TV%20Series.png"
itemlist.append(item.clone(title="Series:", folder=False, text_color="0xFFD4AF37", text_bold=True))
itemlist.append(Item(channel=item.channel, title=" Todas las series", action="series", url=host + "/series/"))
itemlist.append(
Item(channel=item.channel, title=" Nuevos episodios", action="nuevos_episodios", url=host + "/episodio/"))
itemlist.append(
Item(channel=item.channel, title="Buscar...", action="search", url=host, text_color="red", text_bold=True))
itemlist.append(item.clone(title="Configurar canal...", text_color="green", action="configuracion", text_bold=True))
return itemlist
def configuracion(item):
from platformcode import platformtools
ret = platformtools.show_channel_settings()
platformtools.itemlist_refresh()
return ret
from platformcode import platformtools
ret = platformtools.show_channel_settings()
platformtools.itemlist_refresh()
return ret
def newest(categoria):
logger.info()
itemlist = []
item = Item()
try:
if categoria in ["peliculas", "latino"]:
item.url = host
itemlist = peliculas(item)
elif categoria == 'terror':
item.url = host + '/genero/terror/'
itemlist = peliculas(item)
elif categoria == "series":
item.url = host + "/episodio/"
itemlist = nuevos_episodios(item)
if "Pagina" in itemlist[-1].title:
itemlist.pop()
logger.info()
itemlist = []
item = Item()
try:
if categoria in ["peliculas", "latino"]:
item.url = host
itemlist = peliculas(item)
elif categoria == 'terror':
item.url = host + '/genero/terror/'
itemlist = peliculas(item)
elif categoria == "series":
item.url = host + "/episodio/"
itemlist = nuevos_episodios(item)
if "Pagina" in itemlist[-1].title:
itemlist.pop()
# Se captura la excepción, para no interrumpir al canal novedades si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error("{0}".format(line))
return []
# Se captura la excepción, para no interrumpir al canal novedades si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error("{0}".format(line))
return []
return itemlist
return itemlist
def peliculas(item):
#logger.info()
logger.info(item)
itemlist = []
data = httptools.downloadpage(item.url).data
# logger.info()
logger.info(item)
itemlist = []
data = httptools.downloadpage(item.url).data
data2 = scrapertools.find_single_match(data,'(?s)<div class="item_1.*?>(.*?)id="paginador">')
data2 = scrapertools.find_single_match(data, '(?s)<div class="item_1.*?>(.*?)id="paginador">')
# Se saca la info
#(?s)class="ml-item.*?a href="([^"]+).*?img src="([^"]+).*?alt="([^"]+).*?class="year">(\d{4})</span>(.*?)<div
patron = '(?s)class="ml-item.*?' # base
patron += 'a href="([^"]+).*?' # url
patron += 'img src="([^"]+).*?' # imagen
patron += 'alt="([^"]+).*?' # titulo
patron += 'class="year">(\d{4})' # año
patron += '</span>(.*?)<div' # calidad
matches = scrapertools.find_multiple_matches(data2, patron)
# Se saca la info
# (?s)class="ml-item.*?a href="([^"]+).*?img src="([^"]+).*?alt="([^"]+).*?class="year">(\d{4})</span>(.*?)<div
patron = '(?s)class="ml-item.*?' # base
patron += 'a href="([^"]+).*?' # url
patron += 'img src="([^"]+).*?' # imagen
patron += 'alt="([^"]+).*?' # titulo
patron += 'class="year">(\d{4})' # año
patron += '</span>(.*?)<div' # calidad
matches = scrapertools.find_multiple_matches(data2, patron)
scrapertools.printMatches(matches)
for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedyear, scrapedquality in matches:
if not "/series/" in scrapedurl:
scrapedquality = scrapertools.find_single_match(scrapedquality, '<span class="calidad2">(.*?)</span>')
itemlist.append(Item(action = "findvideos", channel = item.channel, title = scrapedtitle + " (" + scrapedyear + ") [" + scrapedquality + "]", contentTitle=scrapedtitle, thumbnail = scrapedthumbnail, url = scrapedurl, quality=scrapedquality, infoLabels={'year':scrapedyear}))
else:
if item.action == "search":
itemlist.append(Item(action = "temporadas", channel = item.channel, title = scrapedtitle + " (" + scrapedyear + ")", contentSerieName=scrapedtitle, contentType="tvshow", thumbnail = scrapedthumbnail, url = scrapedurl, infoLabels={'year':scrapedyear}))
scrapertools.printMatches(matches)
for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedyear, scrapedquality in matches:
if not "/series/" in scrapedurl:
scrapedquality = scrapertools.find_single_match(scrapedquality, '<span class="calidad2">(.*?)</span>')
itemlist.append(Item(action="findvideos", channel=item.channel,
title=scrapedtitle + " (" + scrapedyear + ") [" + scrapedquality + "]",
contentTitle=scrapedtitle, thumbnail=scrapedthumbnail, url=scrapedurl,
quality=scrapedquality, infoLabels={'year': scrapedyear}))
else:
if item.action == "search":
itemlist.append(
Item(action="temporadas", channel=item.channel, title=scrapedtitle + " (" + scrapedyear + ")",
contentSerieName=scrapedtitle, contentType="tvshow", thumbnail=scrapedthumbnail,
url=scrapedurl, infoLabels={'year': scrapedyear}))
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# Pagina siguiente
patron_siguiente = 'class="pag_b"><a href="([^"]+)'
url_pagina_siguiente = scrapertools.find_single_match(data, patron_siguiente)
# Pagina siguiente
patron_siguiente='class="pag_b"><a href="([^"]+)'
url_pagina_siguiente=scrapertools.find_single_match(data, patron_siguiente)
if url_pagina_siguiente != "":
pagina = ">>> Pagina: " + scrapertools.find_single_match(url_pagina_siguiente, '\d+')
itemlist.append(Item(channel=item.channel, action="peliculas", title=pagina, url=url_pagina_siguiente))
if url_pagina_siguiente != "":
pagina = ">>> Pagina: " + scrapertools.find_single_match(url_pagina_siguiente, '\d+')
itemlist.append(Item(channel = item.channel, action = "peliculas", title = pagina, url = url_pagina_siguiente))
return itemlist
return itemlist
def genero(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
# Delimita la búsqueda a la lista donde estan los géneros
data = scrapertools.find_single_match(data,'(?s)<ul id="menu-generos" class="">(.*?)</ul>')
# Extrae la url y el género
patron = '<a href="(.*?)">(.*?)</a></li>'
matches = scrapertools.find_multiple_matches(data, patron)
# Se quita "Estrenos" de la lista porque tiene su propio menu
matches.pop(0)
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
# Delimita la búsqueda a la lista donde estan los géneros
data = scrapertools.find_single_match(data, '(?s)<ul id="menu-generos" class="">(.*?)</ul>')
# Extrae la url y el género
patron = '<a href="(.*?)">(.*?)</a></li>'
matches = scrapertools.find_multiple_matches(data, patron)
# Se quita "Estrenos" de la lista porque tiene su propio menu
matches.pop(0)
for scrapedurl, scrapedtitle in matches:
itemlist.append(Item(action = "peliculas", channel = item.channel, title = scrapedtitle, url = scrapedurl))
for scrapedurl, scrapedtitle in matches:
itemlist.append(Item(action="peliculas", channel=item.channel, title=scrapedtitle, url=scrapedurl))
return itemlist
return itemlist
def series(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
# Se saca la info
patron = '(?s)class="ml-item.*?' # base
patron += 'a href="([^"]+).*?' # url
patron += 'img src="([^"]+).*?' # imagen
patron += 'alt="([^"]+).*?' # titulo
patron += 'class="year">(\d{4})' # año
matches = scrapertools.find_multiple_matches(data, patron)
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
# Se saca la info
patron = '(?s)class="ml-item.*?' # base
patron += 'a href="([^"]+).*?' # url
patron += 'img src="([^"]+).*?' # imagen
patron += 'alt="([^"]+).*?' # titulo
patron += 'class="year">(\d{4})' # año
matches = scrapertools.find_multiple_matches(data, patron)
#if config.get_setting('temporada_o_todos', 'pelisultra') == 0:
if config.get_setting('temporada_o_todos', 'pelisultra'):
accion="temporadas"
else:
accion="episodios"
# if config.get_setting('temporada_o_todos', 'pelisultra') == 0:
if config.get_setting('temporada_o_todos', 'pelisultra'):
accion = "temporadas"
else:
accion = "episodios"
for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedyear in matches:
itemlist.append(Item(action = accion, channel = item.channel, title = scrapedtitle + " (" + scrapedyear + ")", contentSerieName=scrapedtitle, contentType="tvshow", thumbnail = scrapedthumbnail, url = scrapedurl, infoLabels={'year':scrapedyear}))
for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedyear in matches:
itemlist.append(Item(action=accion, channel=item.channel, title=scrapedtitle + " (" + scrapedyear + ")",
contentSerieName=scrapedtitle, contentType="tvshow", thumbnail=scrapedthumbnail,
url=scrapedurl, infoLabels={'year': scrapedyear}))
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# Pagina siguiente
patron_siguiente='class="pag_b"><a href="([^"]+)'
url_pagina_siguiente=scrapertools.find_single_match(data, patron_siguiente)
# Pagina siguiente
patron_siguiente = 'class="pag_b"><a href="([^"]+)'
url_pagina_siguiente = scrapertools.find_single_match(data, patron_siguiente)
if url_pagina_siguiente != "":
pagina = ">>> Pagina: " + scrapertools.find_single_match(url_pagina_siguiente, '\d+')
itemlist.append(Item(channel = item.channel, action = "series", title = pagina, url = url_pagina_siguiente))
if url_pagina_siguiente != "":
pagina = ">>> Pagina: " + scrapertools.find_single_match(url_pagina_siguiente, '\d+')
itemlist.append(Item(channel=item.channel, action="series", title=pagina, url=url_pagina_siguiente))
return itemlist
return itemlist
def temporadas(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
# Extrae las temporadas
patron = '<span class="se-t.*?>(.*?)</span>'
matches = scrapertools.find_multiple_matches(data, patron)
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
# Extrae las temporadas
patron = '<span class="se-t.*?>(.*?)</span>'
matches = scrapertools.find_multiple_matches(data, patron)
# Excepción para la serie Sin Límites
if item.contentTitle == 'Amar sin límites':
item.contentSerieName = "limitless"
item.infoLabels['tmdb_id']=''
# Excepción para la serie Sin Límites
if item.contentTitle == 'Amar sin límites':
item.contentSerieName = "limitless"
item.infoLabels['tmdb_id'] = ''
for scrapedseason in matches:
itemlist.append(item.clone(action = "episodios", title = "Temporada " + scrapedseason, contentSeason=scrapedseason))
for scrapedseason in matches:
itemlist.append(item.clone(action="episodios", title="Temporada " + scrapedseason, contentSeason=scrapedseason))
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
return itemlist
return itemlist
def episodios(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
patron = '(?s)class="episodiotitle">.*?a href="(.*?)">(.*?)</a>'
matches = scrapertools.find_multiple_matches(data, patron)
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
patron = '(?s)class="episodiotitle">.*?a href="(.*?)">(.*?)</a>'
matches = scrapertools.find_multiple_matches(data, patron)
for scrapedurl, scrapedtitle in matches:
# Saco el numero de capitulo de la url
numero_capitulo=scrapertools.get_season_and_episode(scrapedurl)
if numero_capitulo != "":
temporada=numero_capitulo.split("x")[0]
capitulo=numero_capitulo.split("x")[1]
else:
temporada="_"
capitulo="_"
for scrapedurl, scrapedtitle in matches:
# Saco el numero de capitulo de la url
numero_capitulo = scrapertools.get_season_and_episode(scrapedurl)
if numero_capitulo != "":
temporada = numero_capitulo.split("x")[0]
capitulo = numero_capitulo.split("x")[1]
else:
temporada = "_"
capitulo = "_"
if item.contentSeason and str(item.contentSeason) != temporada:
continue
if item.contentSeason and str(item.contentSeason) != temporada:
continue
itemlist.append(item.clone(action = "findvideos", title = numero_capitulo + " - " + scrapedtitle.strip(), url = scrapedurl, contentSeason=temporada, contentEpisodeNumber=capitulo))
itemlist.append(
item.clone(action="findvideos", title=numero_capitulo + " - " + scrapedtitle.strip(), url=scrapedurl,
contentSeason=temporada, contentEpisodeNumber=capitulo))
# if item.contentTitle.startswith('Temporada'):
# if str(item.contentSeason) == temporada:
# itemlist.append(item.clone(action = "findvideos", title = numero_capitulo + " - " + scrapedtitle.strip(), url = scrapedurl, contentSeason=temporada, contentEpisodeNumber=capitulo))
# else:
# itemlist.append(item.clone(action = "findvideos", title = numero_capitulo + " - " + scrapedtitle.strip(), url = scrapedurl, contentSeason=temporada, contentEpisodeNumber=capitulo))
# if item.contentTitle.startswith('Temporada'):
# if str(item.contentSeason) == temporada:
# itemlist.append(item.clone(action = "findvideos", title = numero_capitulo + " - " + scrapedtitle.strip(),
# url = scrapedurl, contentSeason=temporada, contentEpisodeNumber=capitulo))
# else:
# itemlist.append(item.clone(action = "findvideos", title = numero_capitulo + " - " + scrapedtitle.strip(),
# url = scrapedurl, contentSeason=temporada, contentEpisodeNumber=capitulo))
#episodios_por_pagina=20
# if config.get_setting('episodios_x_pag', 'pelisultra').isdigit():
# episodios_por_pagina=int(config.get_setting('episodios_x_pag', 'pelisultra'))
# else:
# episodios_por_pagina=20
# config.set_setting('episodios_x_pag', '20', 'pelisultra')
episodios_por_pagina= int(config.get_setting('episodios_x_pag', 'pelisultra')) * 5 + 10
# episodios_por_pagina=20
# if config.get_setting('episodios_x_pag', 'pelisultra').isdigit():
# episodios_por_pagina=int(config.get_setting('episodios_x_pag', 'pelisultra'))
# else:
# episodios_por_pagina=20
# config.set_setting('episodios_x_pag', '20', 'pelisultra')
if not item.page:
item.page = 0
episodios_por_pagina = int(config.get_setting('episodios_x_pag', 'pelisultra')) * 5 + 10
itemlist_page = itemlist[item.page: item.page + episodios_por_pagina]
if not item.page:
item.page = 0
if len(itemlist) > item.page + episodios_por_pagina:
itemlist_page.append(item.clone(title = ">>> Pagina siguiente", page = item.page + episodios_por_pagina))
itemlist_page = itemlist[item.page: item.page + episodios_por_pagina]
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist_page, seekTmdb=True)
if len(itemlist) > item.page + episodios_por_pagina:
itemlist_page.append(item.clone(title=">>> Pagina siguiente", page=item.page + episodios_por_pagina))
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist_page, seekTmdb=True)
return itemlist_page
return itemlist_page
def nuevos_episodios(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
patron = '(?s)<td class="bb">.*?' # base
patron += '<a href="(.*?)">' # url
patron += '(.*?)</a>.*?' # nombre_serie
patron += '<img src="(.*?)>.*?' # imagen
patron += '<h2>(.*?)</h2>' # titulo
matches = scrapertools.find_multiple_matches(data, patron)
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
patron = '(?s)<td class="bb">.*?' # base
patron += '<a href="(.*?)">' # url
patron += '(.*?)</a>.*?' # nombre_serie
patron += '<img src="(.*?)>.*?' # imagen
patron += '<h2>(.*?)</h2>' # titulo
matches = scrapertools.find_multiple_matches(data, patron)
for scrapedurl, scrapedseriename, scrapedthumbnail, scrapedtitle in matches:
numero_capitulo=scrapertools.get_season_and_episode(scrapedurl)
if numero_capitulo != "":
temporada=numero_capitulo.split("x")[0]
capitulo=numero_capitulo.split("x")[1]
else:
temporada="_"
capitulo="_"
for scrapedurl, scrapedseriename, scrapedthumbnail, scrapedtitle in matches:
numero_capitulo = scrapertools.get_season_and_episode(scrapedurl)
if numero_capitulo != "":
temporada = numero_capitulo.split("x")[0]
capitulo = numero_capitulo.split("x")[1]
else:
temporada = "_"
capitulo = "_"
itemlist.append(Item(channel = item.channel, action = "findvideos", title = scrapedseriename +": " + numero_capitulo + " - " + scrapedtitle.strip(), url = scrapedurl, thumbnail = scrapedthumbnail, contentSerieName=scrapedseriename, contentSeason=temporada, contentEpisodeNumber=capitulo))
itemlist.append(Item(channel=item.channel, action="findvideos",
title=scrapedseriename + ": " + numero_capitulo + " - " + scrapedtitle.strip(),
url=scrapedurl, thumbnail=scrapedthumbnail, contentSerieName=scrapedseriename,
contentSeason=temporada, contentEpisodeNumber=capitulo))
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# InfoLabels:
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# Pagina siguiente
patron_siguiente='class="pag_b"><a href="([^"]+)'
url_pagina_siguiente=scrapertools.find_single_match(data, patron_siguiente)
# Pagina siguiente
patron_siguiente = 'class="pag_b"><a href="([^"]+)'
url_pagina_siguiente = scrapertools.find_single_match(data, patron_siguiente)
if url_pagina_siguiente != "":
pagina = ">>> Pagina: " + scrapertools.find_single_match(url_pagina_siguiente, '\d+')
itemlist.append(Item(channel = item.channel, action = "nuevos_episodios", title = pagina, url = url_pagina_siguiente))
if url_pagina_siguiente != "":
pagina = ">>> Pagina: " + scrapertools.find_single_match(url_pagina_siguiente, '\d+')
itemlist.append(Item(channel=item.channel, action="nuevos_episodios", title=pagina, url=url_pagina_siguiente))
return itemlist
return itemlist
def search(item, texto):
logger.info()
itemlist = []
texto = texto.replace(" ", "+")
try:
item.url = host + "/?s=%s" % texto
itemlist.extend(peliculas(item))
return itemlist
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
logger.info()
itemlist = []
texto = texto.replace(" ", "+")
try:
item.url = host + "/?s=%s" % texto
itemlist.extend(peliculas(item))
return itemlist
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
+1 -1
View File
@@ -38,7 +38,7 @@ def mainlist(item):
itemlist.append(Item(channel=item.channel, action="opciones", title="Opciones",
thumbnail=get_thumb("search.png")))
itemlist.append(Item(channel="tvmoviedb", action="mainlist", title="Busquèda alternativa",
itemlist.append(Item(channel="tvmoviedb", action="mainlist", title="Búsqueda alternativa",
thumbnail=get_thumb("search.png")))
saved_searches_list = get_saved_searches()
+9 -9
View File
@@ -16,14 +16,14 @@ HOST = 'http://seriesdanko.to/'
IDIOMAS = {'es': 'Español', 'la': 'Latino', 'vos': 'VOS', 'vo': 'VO'}
list_idiomas = IDIOMAS.values()
list_servers = ['streamcloud', 'powvideo', 'gamovideo', 'streamplay', 'openload', 'flashx', 'nowvideo', 'thevideo']
CALIDADES = ['SD', 'MicroHD', 'HD/MKV']
list_quality = ['SD', 'MicroHD', 'HD/MKV']
def mainlist(item):
logger.info()
autoplay.init(item.channel, list_servers, CALIDADES)
autoplay.init(item.channel, list_servers, list_quality)
itemlist = list()
itemlist.append(Item(channel=item.channel, title="Novedades", action="novedades", url=HOST))
@@ -33,7 +33,7 @@ def mainlist(item):
itemlist.append(Item(channel=item.channel, title="Buscar...", action="search",
url=urlparse.urljoin(HOST, "all.php")))
itemlist = filtertools.show_option(itemlist, item.channel, list_idiomas, CALIDADES)
itemlist = filtertools.show_option(itemlist, item.channel, list_idiomas, list_quality)
autoplay.show_option(item.channel, itemlist)
@@ -76,7 +76,7 @@ def novedades(item):
itemlist.append(Item(channel=item.channel, title=title, url=urlparse.urljoin(HOST, scrapedurl), show=show,
action="episodios", thumbnail=scrapedthumb,
context=filtertools.context(item, list_idiomas, CALIDADES), language=language))
context=filtertools.context(item, list_idiomas, list_quality), language=language))
return itemlist
@@ -124,7 +124,7 @@ def series_seccion(item):
for scrapedurl, scrapedtitle in matches[item.first:limit]:
itemlist.append(Item(channel=item.channel, action="episodios", title=scrapedtitle, show=scrapedtitle,
url=urlparse.urljoin(HOST, scrapedurl),
context=filtertools.context(item, list_idiomas, CALIDADES)))
context=filtertools.context(item, list_idiomas, list_quality)))
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
#pagination
@@ -157,7 +157,7 @@ def series_por_letra(item):
itemlist = []
for url, title, img in shows:
itemlist.append(item.clone(title=title, url=urlparse.urljoin(HOST, url), action="episodios", thumbnail=img,
show=title, context=filtertools.context(item, list_idiomas, CALIDADES)))
show=title, context=filtertools.context(item, list_idiomas, list_quality)))
return itemlist
@@ -172,7 +172,7 @@ def search(item, texto):
data, re.IGNORECASE)
for url, title in shows:
itemlist.append(item.clone(title=title, url=urlparse.urljoin(HOST, url), action="episodios", show=title,
context=filtertools.context(item, list_idiomas, CALIDADES)))
context=filtertools.context(item, list_idiomas, list_quality)))
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
@@ -228,7 +228,7 @@ def episodios(item):
infoLabels=infoLabels))
itemlist = filtertools.get_links(itemlist, item, list_idiomas, CALIDADES)
itemlist = filtertools.get_links(itemlist, item, list_idiomas, list_quality)
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
# Opción "Añadir esta serie a la videoteca de XBMC"
@@ -266,7 +266,7 @@ def findvideos(item):
# Requerido para FilterTools
itemlist = filtertools.get_links(itemlist, item, list_idiomas, CALIDADES)
itemlist = filtertools.get_links(itemlist, item, list_idiomas, list_quality)
# Requerido para AutoPlay
+7 -7
View File
@@ -21,7 +21,7 @@ HOST = "http://www.seriespapaya.com"
IDIOMAS = {'es': 'Español', 'lat': 'Latino', 'in': 'Inglés', 'ca': 'Catalán', 'sub': 'VOSE', 'Español Latino':'lat',
'Español Castellano':'es', 'Sub Español':'VOSE'}
list_idiomas = IDIOMAS.values()
CALIDADES = ['360p', '480p', '720p HD', '1080p HD', 'default']
list_quality = ['360p', '480p', '720p HD', '1080p HD', 'default']
list_servers = ['powvideo', 'streamplay', 'filebebo', 'flashx', 'gamovideo', 'nowvideo', 'openload', 'streamango',
'streamcloud', 'vidzi', 'clipwatching', ]
@@ -29,7 +29,7 @@ list_servers = ['powvideo', 'streamplay', 'filebebo', 'flashx', 'gamovideo', 'no
def mainlist(item):
logger.info()
autoplay.init(item.channel, list_servers, CALIDADES)
autoplay.init(item.channel, list_servers, list_quality)
thumb_series = get_thumb("channels_tvshow.png")
thumb_series_az = get_thumb("channels_tvshow_az.png")
@@ -42,7 +42,7 @@ def mainlist(item):
Item(action="novedades", title="Capítulos de estreno", channel=item.channel, thumbnail=thumb_series))
itemlist.append(Item(action="search", title="Buscar", channel=item.channel, thumbnail=thumb_buscar))
itemlist = filtertools.show_option(itemlist, item.channel, list_idiomas, CALIDADES)
itemlist = filtertools.show_option(itemlist, item.channel, list_idiomas, list_quality)
autoplay.show_option(item.channel, itemlist)
@@ -92,7 +92,7 @@ def series_por_letra_y_grupo(item):
show=name,
url=urlparse.urljoin(HOST, url),
thumbnail=urlparse.urljoin(HOST, img),
context=filtertools.context(item, list_idiomas, CALIDADES),
context=filtertools.context(item, list_idiomas, list_quality),
plot = plot,
infoLabels={'year':year}
)
@@ -153,7 +153,7 @@ def episodios(item):
language=filter_lang
))
itemlist = filtertools.get_links(itemlist, item, list_idiomas, CALIDADES)
itemlist = filtertools.get_links(itemlist, item, list_idiomas, list_quality)
# Opción "Añadir esta serie a la videoteca de XBMC"
if config.get_videolibrary_support() and len(itemlist) > 0:
@@ -177,7 +177,7 @@ def search(item, texto):
show=show["titulo"],
url=urlparse.urljoin(HOST, show["urla"]),
thumbnail=urlparse.urljoin(HOST, show["img"]),
context=filtertools.context(item, list_idiomas, CALIDADES)
context=filtertools.context(item, list_idiomas, list_quality)
) for show in tvshows]
@@ -227,7 +227,7 @@ def findvideos(item):
# Requerido para FilterTools
itemlist = filtertools.get_links(itemlist, item, list_idiomas, CALIDADES)
itemlist = filtertools.get_links(itemlist, item, list_idiomas, list_quality)
# Requerido para AutoPlay
+6 -4
View File
@@ -83,7 +83,7 @@ def list_all(item):
url = host + scrapedurl
thumbnail = scrapedthumbnail
title = scrapedtitle
title = scrapertools.decodeHtmlentities(scrapedtitle)
itemlist.append(Item(channel=item.channel,
action='seasons',
@@ -125,7 +125,10 @@ def section(item):
for scrapedurl, scrapedtitle in matches:
url = host + scrapedurl
if item.title == 'Generos':
url = host + scrapedurl
else:
url = scrapedurl
title = scrapedtitle
itemlist.append(Item(channel=item.channel,
action='list_all',
@@ -211,7 +214,6 @@ def add_language(title, string):
languages = scrapertools.find_multiple_matches(string, '/banderas/(.*?).png')
language = []
for lang in languages:
@@ -219,7 +221,7 @@ def add_language(title, string):
lang = 'vos'
if len(languages) == 1:
language = IDIOMAS[languages[0]]
language = IDIOMAS[lang]
title = '%s [%s]' % (title, language)
else:
language.append(IDIOMAS[lang])
+68 -296
View File
@@ -4,6 +4,7 @@ import re
import sys
import urllib
import urlparse
import datetime
from channelselector import get_thumb
from core import httptools
@@ -12,6 +13,7 @@ from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
from lib import generictools
host = 'http://torrentlocura.com/'
@@ -145,11 +147,7 @@ def listado(item):
clase = "pelilist" # etiqueta para localizar zona de listado de contenidos
url_next_page ='' # Controlde paginación
cnt_tot = 30 # Poner el num. máximo de items por página
category = "" # Guarda la categoria que viene desde una busqueda global
if item.category:
category = item.category
del item.category
if item.totalItems:
del item.totalItems
@@ -258,8 +256,10 @@ def listado(item):
del item_local.tipo
if item_local.totalItems:
del item_local.totalItems
if item.post_num:
del item.post_num
if item_local.post_num:
del item_local.post_num
if item_local.category:
del item_local.category
item_local.title = ''
item_local.context = "['buscar_trailer']"
@@ -336,8 +336,8 @@ def listado(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("Espa", "").replace("Ingl", "").replace("Engl", "").replace("Calidad", "").replace("de la Serie", "")
title_alt = title_alt.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Espa", "").replace("Ingl", "").replace("Engl", "").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", "")
title_alt = title_alt.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)
@@ -347,7 +347,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -403,65 +403,8 @@ def listado(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
if category == "newest": #Viene de Novedades. Marquemos el título con el nombre del canal
title += ' -%s-' % item_local.channel.capitalize()
if item_local.contentType == "movie":
item_local.contentTitle += ' -%s-' % item_local.channel.capitalize()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if len(itemlist) == 0:
itemlist.append(Item(channel=item.channel, action="mainlist", title="No se ha podido cargar el listado"))
@@ -728,7 +671,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("Esp", "").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("Ing", "").replace("Eng", "").replace("Calidad", "").replace("de la Serie", "")
#Limpiamos cabeceras y colas del título
title = re.sub(r'Descargar\s\w+\-\w+', '', title)
@@ -738,7 +681,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -868,64 +811,8 @@ def listado_busqueda(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
title += " -Serie-"
elif item_local.extra == "varios":
title += " -Varios-"
item_local.contentTitle += " -Varios-"
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + "[" + str(item_local.language) + "]" + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if post:
itemlist.append(item.clone(channel=item.channel, action="listado_busqueda", title="[COLOR gold][B]Pagina siguiente >> [/B][/COLOR]" + str(post_num) + " de " + str(total_pag), thumbnail=get_thumb("next.png"), title_lista=title_lista, cnt_pag=cnt_pag))
@@ -1042,32 +929,7 @@ def findvideos(item):
verificar_enlaces_descargas = -1 #Verificar todos los enlaces Descargar
verificar_enlaces_descargas_validos = True #"¿Contar sólo enlaces 'verificados' en Descargar?"
excluir_enlaces_descargas = [] #Lista vacía de servidores excluidos en Descargar
# Saber si estamos en una ventana emergente lanzada desde una viñeta del menú principal,
# con la función "play_from_library"
unify_status = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
unify_status = config.get_setting("unify")
except:
unify_status = config.get_setting("unify")
#Salvamos la información de max num. de episodios por temporada para despues de TMDB
if item.infoLabels['temporada_num_episodios']:
num_episodios = item.infoLabels['temporada_num_episodios']
else:
num_episodios = 1
# Obtener la información actualizada del Episodio, si no la hay
if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'):
tmdb.set_infoLabels(item, __modo_grafico__)
elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary":
tmdb.set_infoLabels(item, __modo_grafico__)
#Restauramos la información de max num. de episodios por temporada despues de TMDB
if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']:
item.infoLabels['temporada_num_episodios'] = num_episodios
# Descarga la página
try:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
@@ -1081,17 +943,15 @@ def findvideos(item):
#Añadimos el tamaño para todos
size = scrapertools.find_single_match(data, '<div class="entry-left".*?><a href=".*?span class=.*?>Size:<\/strong>?\s(\d+?\.?\d*?\s\w[b|B])<\/span>')
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
if size:
item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
#Limpiamos de año y rating de episodios
if item.infoLabels['episodio_titulo']:
item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo'])
item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(item.wanted, '')
if item.infoLabels['aired'] and item.contentType == "episode":
item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})')
if not size:
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B])\]')
else:
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
@@ -1100,57 +960,29 @@ def findvideos(item):
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";'
item_local.url = scrapertools.find_single_match(data, patron)
if not item_local.url: #error
logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
#logger.debug("Patron: " + patron + " url: " + item_local.url)
#logger.debug(data)
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
rating = '' #Ponemos el rating
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
if item_local.contentType == "episode":
title = '%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
if item_local.infoLabels['temporada_num_episodios']:
title = '%s (de %s)' % (title, str(item_local.infoLabels['temporada_num_episodios']))
title = '%s %s' % (title, item_local.infoLabels['episodio_titulo'])
title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language), size)
else:
title = item_local.title
title_gen = title
title_gen = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title_gen).strip() #Quitamos etiquetas vacías
title_gen = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title_gen).strip() #Quitamos colores vacíos
title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen)
else:
title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen)
if config.get_setting("quit_channel_name", "videolibrary") == 1 and item_local.contentChannel == "videolibrary":
title_gen = '%s: %s' % (item_local.channel.capitalize(), title_gen)
itemlist.append(item_local.clone(title=title_gen)) #Título con todos los datos del vídeo
#Ahora pintamos el link del Torrent, si lo hay
if item_local.url: # Hay Torrent ?
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos etiquetas vacías
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos colores vacíos
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.server = "torrent" #Servidor
if size:
quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título
else:
quality = item_local.quality
itemlist.append(item_local.clone()) #Pintar pantalla
itemlist.append(item_local.clone(quality=quality)) #Pintar pantalla
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + title_gen + " / " + title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
#logger.debug(item_local)
# VER vídeos, descargar vídeos un link, o múltiples links
@@ -1236,7 +1068,7 @@ def findvideos(item):
if len(enlaces_descargar) > 0 and ver_enlaces_descargas != 0:
#Pintamos un pseudo-título de Descargas
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
if not item.unify: #Si Titulos Inteligentes NO seleccionados:
itemlist.append(item_local.clone(title="[COLOR gold]**- Enlaces Descargar: -**[/COLOR]", action=""))
else:
itemlist.append(item_local.clone(title="[COLOR gold] Enlaces Descargar: [/COLOR]", action=""))
@@ -1261,7 +1093,7 @@ def findvideos(item):
#Recorremos cada una de las partes. Vemos si el primer link está activo. Si no lo está ignoramos todo el enlace
p = 1
for enlace in partes:
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = "[COLOR yellow][%s][/COLOR] %s (%s/%s) [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
else:
parte_title = "[COLOR yellow]%s-[/COLOR] %s %s/%s [COLOR limegreen]-%s[/COLOR] [COLOR red]-%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
@@ -1303,12 +1135,12 @@ def findvideos(item):
break #Si se ha agotado el contador de verificación, se sale de "Enlace"
if item_local.alive == "??": #dudoso
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR yellow][?][/COLOR] %s' % (parte_title)
else:
parte_title = '[COLOR yellow]%s[/COLOR]-%s' % (item_local.alive, parte_title)
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR red][%s][/COLOR] %s' % (item_local.alive, parte_title)
else:
parte_title = '[COLOR red]%s[/COLOR]-%s' % (item_local.alive, parte_title)
@@ -1377,7 +1209,7 @@ def episodios(item):
list_pages = [item.url]
season = max_temp
if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas
if item.library_playcounts or item.tmdb_stat: #Comprobamos si realmente sabemos el num. máximo de temporadas
num_temporadas_flag = True
else:
num_temporadas_flag = False
@@ -1441,10 +1273,15 @@ def episodios(item):
if scrapertools.find_single_match(info, '\[\d{3}\]'):
info = re.sub(r'\[(\d{3}\])', r'[Cap.\1', info)
elif scrapertools.find_single_match(info, 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'):
pattern = 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'
elif scrapertools.find_single_match(info, '\[Cap.\d{2}_\d{2}\]'):
info = re.sub(r'\[Cap.(\d{2})_(\d{2})\]', r'[Cap.1\1_1\2]', info)
elif scrapertools.find_single_match(info, '\[Cap.([A-Za-z]+)\]'):
info = re.sub(r'\[Cap.([A-Za-z]+)\]', '[Cap.100]', info)
elif "completa" in info.lower():
info = info.replace("COMPLETA", "Caps. 01_99")
pattern = 'Temp.*?(?P<season>\d+).*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<quality>.*?)\].*?\[(?P<lang>\w+)\]?'
if scrapertools.find_single_match(info, '\[Cap.\d{2,3}'):
pattern = "\[(?P<quality>.*?)\].*?\[Cap.(?P<season>\d).*?(?P<episode>\d{2})(?:_(?P<season2>\d+)" \
"(?P<episode2>\d{2}))?.*?\].*?(?:\[(?P<lang>.*?)\])?"
@@ -1475,15 +1312,18 @@ def episodios(item):
except:
logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / " + str(match['episode2']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
if num_temporadas_flag and match['season'] != season and match['season'] > max_temp + 1:
#Si el num de temporada está fuera de control, se trata pone en num. de temporada actual
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
match['season'] = season
item_local.contentSeason = season
else:
item_local.contentSeason = match['season']
season = match['season']
num_temporadas_flag = True
if match['episode'] > 0:
num_temporadas_flag = True
if season > max_temp:
max_temp = season
@@ -1496,12 +1336,13 @@ def episodios(item):
item_local.infoLabels['episodio_titulo'] = match['lang']
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.contentEpisodeNumber = match['episode']
if match['episode'] == 0: match['episode'] = 1 #Evitar errores en Videoteca
if match["episode2"]: #Hay episodio dos? es una entrada múltiple?
item_local.title = "%sx%s al %s -" % (str(match["season"]), str(match["episode"]).zfill(2), str(match["episode2"]).zfill(2)) #Creamos un título con el rango de episodios
else: #Si es un solo episodio, se formatea ya
item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2))
item_local.contentEpisodeNumber = match['episode']
if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca
if item_local.contentSeason < max_temp:
@@ -1541,92 +1382,23 @@ def episodios(item):
# Pasada por TMDB y clasificación de lista por temporada y episodio
tmdb.set_infoLabels(itemlist, True)
# Pasada para maqullaje de los títulos obtenidos desde TMDB
num_episodios = 1
num_episodios_lista = []
for i in range(0, 50): num_episodios_lista += [0]
num_temporada = 1
num_temporada_max = 99
num_episodios_flag = True
for item_local in itemlist:
# Si no hay datos de TMDB, pongo los datos locales que conozco
if item_local.infoLabels['aired']:
item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Salvamos en número de episodios de la temporada
if item_local.infoLabels['number_of_seasons']:
#Si el num de temporada está fuera de control, se pone 0, y se reclasifica itemlist
if item_local.contentSeason > item_local.infoLabels['number_of_seasons'] + 1:
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(item_local.infoLabels['number_of_seasons']) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
else:
num_temporada_max = item_local.infoLabels['number_of_seasons']
else:
if item_local.contentSeason > num_temporada_max + 1:
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))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
if num_temporada != item_local.contentSeason:
num_temporada = item_local.contentSeason
num_episodios = 0
if item_local.infoLabels['temporada_num_episodios']:
num_episodios = item_local.infoLabels['temporada_num_episodios']
#Preparamos el título para que sea compatible con Añadir Serie a Videoteca
if item_local.infoLabels['episodio_titulo']:
if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName)
else:
item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo'])
if item_local.infoLabels['year']:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'])
if rating:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating)
else:
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating)
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language))
#Quitamos campos vacíos
item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "").strip()
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
if num_episodios < item_local.contentEpisodeNumber:
num_episodios = item_local.contentEpisodeNumber
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
item_local.infoLabels['temporada_num_episodios'] = num_episodios
num_episodios_flag = False
num_episodios_lista[item_local.contentSeason] = [num_episodios]
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
#logger.debug(item_local)
try:
if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie
for item_local in itemlist:
item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason]
except:
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))
if config.get_videolibrary_support() and len(itemlist) > 0:
title = ''
if item_local.infoLabels['temporada_num_episodios']:
title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios']
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]" + title, action="add_serie_to_library", extra="episodios"))
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
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 launcher.run(item)
def search(item, texto):
logger.info("search:" + texto)
+68 -296
View File
@@ -4,6 +4,7 @@ import re
import sys
import urllib
import urlparse
import datetime
from channelselector import get_thumb
from core import httptools
@@ -12,6 +13,7 @@ from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
from lib import generictools
host = 'http://torrentrapid.com/'
@@ -145,11 +147,7 @@ def listado(item):
clase = "pelilist" # etiqueta para localizar zona de listado de contenidos
url_next_page ='' # Controlde paginación
cnt_tot = 30 # Poner el num. máximo de items por página
category = "" # Guarda la categoria que viene desde una busqueda global
if item.category:
category = item.category
del item.category
if item.totalItems:
del item.totalItems
@@ -258,8 +256,10 @@ def listado(item):
del item_local.tipo
if item_local.totalItems:
del item_local.totalItems
if item.post_num:
del item.post_num
if item_local.post_num:
del item_local.post_num
if item_local.category:
del item_local.category
item_local.title = ''
item_local.context = "['buscar_trailer']"
@@ -336,8 +336,8 @@ def listado(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("Espa", "").replace("Ingl", "").replace("Engl", "").replace("Calidad", "").replace("de la Serie", "")
title_alt = title_alt.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Espa", "").replace("Ingl", "").replace("Engl", "").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", "")
title_alt = title_alt.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)
@@ -347,7 +347,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -403,65 +403,8 @@ def listado(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
if category == "newest": #Viene de Novedades. Marquemos el título con el nombre del canal
title += ' -%s-' % item_local.channel.capitalize()
if item_local.contentType == "movie":
item_local.contentTitle += ' -%s-' % item_local.channel.capitalize()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if len(itemlist) == 0:
itemlist.append(Item(channel=item.channel, action="mainlist", title="No se ha podido cargar el listado"))
@@ -728,7 +671,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("Esp", "").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("Ing", "").replace("Eng", "").replace("Calidad", "").replace("de la Serie", "")
#Limpiamos cabeceras y colas del título
title = re.sub(r'Descargar\s\w+\-\w+', '', title)
@@ -738,7 +681,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -868,64 +811,8 @@ def listado_busqueda(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
title += " -Serie-"
elif item_local.extra == "varios":
title += " -Varios-"
item_local.contentTitle += " -Varios-"
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + "[" + str(item_local.language) + "]" + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if post:
itemlist.append(item.clone(channel=item.channel, action="listado_busqueda", title="[COLOR gold][B]Pagina siguiente >> [/B][/COLOR]" + str(post_num) + " de " + str(total_pag), thumbnail=get_thumb("next.png"), title_lista=title_lista, cnt_pag=cnt_pag))
@@ -1042,32 +929,7 @@ def findvideos(item):
verificar_enlaces_descargas = -1 #Verificar todos los enlaces Descargar
verificar_enlaces_descargas_validos = True #"¿Contar sólo enlaces 'verificados' en Descargar?"
excluir_enlaces_descargas = [] #Lista vacía de servidores excluidos en Descargar
# Saber si estamos en una ventana emergente lanzada desde una viñeta del menú principal,
# con la función "play_from_library"
unify_status = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
unify_status = config.get_setting("unify")
except:
unify_status = config.get_setting("unify")
#Salvamos la información de max num. de episodios por temporada para despues de TMDB
if item.infoLabels['temporada_num_episodios']:
num_episodios = item.infoLabels['temporada_num_episodios']
else:
num_episodios = 1
# Obtener la información actualizada del Episodio, si no la hay
if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'):
tmdb.set_infoLabels(item, __modo_grafico__)
elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary":
tmdb.set_infoLabels(item, __modo_grafico__)
#Restauramos la información de max num. de episodios por temporada despues de TMDB
if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']:
item.infoLabels['temporada_num_episodios'] = num_episodios
# Descarga la página
try:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
@@ -1081,17 +943,15 @@ def findvideos(item):
#Añadimos el tamaño para todos
size = scrapertools.find_single_match(data, '<div class="entry-left".*?><a href=".*?span class=.*?>Size:<\/strong>?\s(\d+?\.?\d*?\s\w[b|B])<\/span>')
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
if size:
item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
#Limpiamos de año y rating de episodios
if item.infoLabels['episodio_titulo']:
item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo'])
item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(item.wanted, '')
if item.infoLabels['aired'] and item.contentType == "episode":
item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})')
if not size:
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B])\]')
else:
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
@@ -1100,57 +960,29 @@ def findvideos(item):
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";'
item_local.url = scrapertools.find_single_match(data, patron)
if not item_local.url: #error
logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
#logger.debug("Patron: " + patron + " url: " + item_local.url)
#logger.debug(data)
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
rating = '' #Ponemos el rating
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
if item_local.contentType == "episode":
title = '%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
if item_local.infoLabels['temporada_num_episodios']:
title = '%s (de %s)' % (title, str(item_local.infoLabels['temporada_num_episodios']))
title = '%s %s' % (title, item_local.infoLabels['episodio_titulo'])
title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language), size)
else:
title = item_local.title
title_gen = title
title_gen = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title_gen).strip() #Quitamos etiquetas vacías
title_gen = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title_gen).strip() #Quitamos colores vacíos
title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen)
else:
title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen)
if config.get_setting("quit_channel_name", "videolibrary") == 1 and item_local.contentChannel == "videolibrary":
title_gen = '%s: %s' % (item_local.channel.capitalize(), title_gen)
itemlist.append(item_local.clone(title=title_gen)) #Título con todos los datos del vídeo
#Ahora pintamos el link del Torrent, si lo hay
if item_local.url: # Hay Torrent ?
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos etiquetas vacías
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos colores vacíos
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.server = "torrent" #Servidor
if size:
quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título
else:
quality = item_local.quality
itemlist.append(item_local.clone()) #Pintar pantalla
itemlist.append(item_local.clone(quality=quality)) #Pintar pantalla
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + title_gen + " / " + title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
#logger.debug(item_local)
# VER vídeos, descargar vídeos un link, o múltiples links
@@ -1236,7 +1068,7 @@ def findvideos(item):
if len(enlaces_descargar) > 0 and ver_enlaces_descargas != 0:
#Pintamos un pseudo-título de Descargas
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
if not item.unify: #Si Titulos Inteligentes NO seleccionados:
itemlist.append(item_local.clone(title="[COLOR gold]**- Enlaces Descargar: -**[/COLOR]", action=""))
else:
itemlist.append(item_local.clone(title="[COLOR gold] Enlaces Descargar: [/COLOR]", action=""))
@@ -1261,7 +1093,7 @@ def findvideos(item):
#Recorremos cada una de las partes. Vemos si el primer link está activo. Si no lo está ignoramos todo el enlace
p = 1
for enlace in partes:
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = "[COLOR yellow][%s][/COLOR] %s (%s/%s) [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
else:
parte_title = "[COLOR yellow]%s-[/COLOR] %s %s/%s [COLOR limegreen]-%s[/COLOR] [COLOR red]-%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
@@ -1303,12 +1135,12 @@ def findvideos(item):
break #Si se ha agotado el contador de verificación, se sale de "Enlace"
if item_local.alive == "??": #dudoso
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR yellow][?][/COLOR] %s' % (parte_title)
else:
parte_title = '[COLOR yellow]%s[/COLOR]-%s' % (item_local.alive, parte_title)
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR red][%s][/COLOR] %s' % (item_local.alive, parte_title)
else:
parte_title = '[COLOR red]%s[/COLOR]-%s' % (item_local.alive, parte_title)
@@ -1377,7 +1209,7 @@ def episodios(item):
list_pages = [item.url]
season = max_temp
if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas
if item.library_playcounts or item.tmdb_stat: #Comprobamos si realmente sabemos el num. máximo de temporadas
num_temporadas_flag = True
else:
num_temporadas_flag = False
@@ -1441,10 +1273,15 @@ def episodios(item):
if scrapertools.find_single_match(info, '\[\d{3}\]'):
info = re.sub(r'\[(\d{3}\])', r'[Cap.\1', info)
elif scrapertools.find_single_match(info, 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'):
pattern = 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'
elif scrapertools.find_single_match(info, '\[Cap.\d{2}_\d{2}\]'):
info = re.sub(r'\[Cap.(\d{2})_(\d{2})\]', r'[Cap.1\1_1\2]', info)
elif scrapertools.find_single_match(info, '\[Cap.([A-Za-z]+)\]'):
info = re.sub(r'\[Cap.([A-Za-z]+)\]', '[Cap.100]', info)
elif "completa" in info.lower():
info = info.replace("COMPLETA", "Caps. 01_99")
pattern = 'Temp.*?(?P<season>\d+).*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<quality>.*?)\].*?\[(?P<lang>\w+)\]?'
if scrapertools.find_single_match(info, '\[Cap.\d{2,3}'):
pattern = "\[(?P<quality>.*?)\].*?\[Cap.(?P<season>\d).*?(?P<episode>\d{2})(?:_(?P<season2>\d+)" \
"(?P<episode2>\d{2}))?.*?\].*?(?:\[(?P<lang>.*?)\])?"
@@ -1475,15 +1312,18 @@ def episodios(item):
except:
logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / " + str(match['episode2']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
if num_temporadas_flag and match['season'] != season and match['season'] > max_temp + 1:
#Si el num de temporada está fuera de control, se trata pone en num. de temporada actual
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
match['season'] = season
item_local.contentSeason = season
else:
item_local.contentSeason = match['season']
season = match['season']
num_temporadas_flag = True
if match['episode'] > 0:
num_temporadas_flag = True
if season > max_temp:
max_temp = season
@@ -1496,12 +1336,13 @@ def episodios(item):
item_local.infoLabels['episodio_titulo'] = match['lang']
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.contentEpisodeNumber = match['episode']
if match['episode'] == 0: match['episode'] = 1 #Evitar errores en Videoteca
if match["episode2"]: #Hay episodio dos? es una entrada múltiple?
item_local.title = "%sx%s al %s -" % (str(match["season"]), str(match["episode"]).zfill(2), str(match["episode2"]).zfill(2)) #Creamos un título con el rango de episodios
else: #Si es un solo episodio, se formatea ya
item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2))
item_local.contentEpisodeNumber = match['episode']
if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca
if item_local.contentSeason < max_temp:
@@ -1541,92 +1382,23 @@ def episodios(item):
# Pasada por TMDB y clasificación de lista por temporada y episodio
tmdb.set_infoLabels(itemlist, True)
# Pasada para maqullaje de los títulos obtenidos desde TMDB
num_episodios = 1
num_episodios_lista = []
for i in range(0, 50): num_episodios_lista += [0]
num_temporada = 1
num_temporada_max = 99
num_episodios_flag = True
for item_local in itemlist:
# Si no hay datos de TMDB, pongo los datos locales que conozco
if item_local.infoLabels['aired']:
item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Salvamos en número de episodios de la temporada
if item_local.infoLabels['number_of_seasons']:
#Si el num de temporada está fuera de control, se pone 0, y se reclasifica itemlist
if item_local.contentSeason > item_local.infoLabels['number_of_seasons'] + 1:
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(item_local.infoLabels['number_of_seasons']) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
else:
num_temporada_max = item_local.infoLabels['number_of_seasons']
else:
if item_local.contentSeason > num_temporada_max + 1:
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))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
if num_temporada != item_local.contentSeason:
num_temporada = item_local.contentSeason
num_episodios = 0
if item_local.infoLabels['temporada_num_episodios']:
num_episodios = item_local.infoLabels['temporada_num_episodios']
#Preparamos el título para que sea compatible con Añadir Serie a Videoteca
if item_local.infoLabels['episodio_titulo']:
if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName)
else:
item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo'])
if item_local.infoLabels['year']:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'])
if rating:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating)
else:
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating)
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language))
#Quitamos campos vacíos
item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "").strip()
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
if num_episodios < item_local.contentEpisodeNumber:
num_episodios = item_local.contentEpisodeNumber
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
item_local.infoLabels['temporada_num_episodios'] = num_episodios
num_episodios_flag = False
num_episodios_lista[item_local.contentSeason] = [num_episodios]
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
#logger.debug(item_local)
try:
if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie
for item_local in itemlist:
item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason]
except:
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))
if config.get_videolibrary_support() and len(itemlist) > 0:
title = ''
if item_local.infoLabels['temporada_num_episodios']:
title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios']
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]" + title, action="add_serie_to_library", extra="episodios"))
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
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 launcher.run(item)
def search(item, texto):
logger.info("search:" + texto)
+68 -296
View File
@@ -4,6 +4,7 @@ import re
import sys
import urllib
import urlparse
import datetime
from channelselector import get_thumb
from core import httptools
@@ -12,6 +13,7 @@ from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
from lib import generictools
host = 'http://tumejortorrent.com/'
@@ -145,11 +147,7 @@ def listado(item):
clase = "pelilist" # etiqueta para localizar zona de listado de contenidos
url_next_page ='' # Controlde paginación
cnt_tot = 30 # Poner el num. máximo de items por página
category = "" # Guarda la categoria que viene desde una busqueda global
if item.category:
category = item.category
del item.category
if item.totalItems:
del item.totalItems
@@ -258,8 +256,10 @@ def listado(item):
del item_local.tipo
if item_local.totalItems:
del item_local.totalItems
if item.post_num:
del item.post_num
if item_local.post_num:
del item_local.post_num
if item_local.category:
del item_local.category
item_local.title = ''
item_local.context = "['buscar_trailer']"
@@ -336,8 +336,8 @@ def listado(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("Espa", "").replace("Ingl", "").replace("Engl", "").replace("Calidad", "").replace("de la Serie", "")
title_alt = title_alt.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Espa", "").replace("Ingl", "").replace("Engl", "").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", "")
title_alt = title_alt.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)
@@ -347,7 +347,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -403,65 +403,8 @@ def listado(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
if category == "newest": #Viene de Novedades. Marquemos el título con el nombre del canal
title += ' -%s-' % item_local.channel.capitalize()
if item_local.contentType == "movie":
item_local.contentTitle += ' -%s-' % item_local.channel.capitalize()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if len(itemlist) == 0:
itemlist.append(Item(channel=item.channel, action="mainlist", title="No se ha podido cargar el listado"))
@@ -728,7 +671,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("Esp", "").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("Ing", "").replace("Eng", "").replace("Calidad", "").replace("de la Serie", "")
#Limpiamos cabeceras y colas del título
title = re.sub(r'Descargar\s\w+\-\w+', '', title)
@@ -738,7 +681,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -868,64 +811,8 @@ def listado_busqueda(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
title += " -Serie-"
elif item_local.extra == "varios":
title += " -Varios-"
item_local.contentTitle += " -Varios-"
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + "[" + str(item_local.language) + "]" + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if post:
itemlist.append(item.clone(channel=item.channel, action="listado_busqueda", title="[COLOR gold][B]Pagina siguiente >> [/B][/COLOR]" + str(post_num) + " de " + str(total_pag), thumbnail=get_thumb("next.png"), title_lista=title_lista, cnt_pag=cnt_pag))
@@ -1042,32 +929,7 @@ def findvideos(item):
verificar_enlaces_descargas = -1 #Verificar todos los enlaces Descargar
verificar_enlaces_descargas_validos = True #"¿Contar sólo enlaces 'verificados' en Descargar?"
excluir_enlaces_descargas = [] #Lista vacía de servidores excluidos en Descargar
# Saber si estamos en una ventana emergente lanzada desde una viñeta del menú principal,
# con la función "play_from_library"
unify_status = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
unify_status = config.get_setting("unify")
except:
unify_status = config.get_setting("unify")
#Salvamos la información de max num. de episodios por temporada para despues de TMDB
if item.infoLabels['temporada_num_episodios']:
num_episodios = item.infoLabels['temporada_num_episodios']
else:
num_episodios = 1
# Obtener la información actualizada del Episodio, si no la hay
if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'):
tmdb.set_infoLabels(item, __modo_grafico__)
elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary":
tmdb.set_infoLabels(item, __modo_grafico__)
#Restauramos la información de max num. de episodios por temporada despues de TMDB
if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']:
item.infoLabels['temporada_num_episodios'] = num_episodios
# Descarga la página
try:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
@@ -1081,17 +943,15 @@ def findvideos(item):
#Añadimos el tamaño para todos
size = scrapertools.find_single_match(data, '<div class="entry-left".*?><a href=".*?span class=.*?>Size:<\/strong>?\s(\d+?\.?\d*?\s\w[b|B])<\/span>')
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
if size:
item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
#Limpiamos de año y rating de episodios
if item.infoLabels['episodio_titulo']:
item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo'])
item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(item.wanted, '')
if item.infoLabels['aired'] and item.contentType == "episode":
item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})')
if not size:
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B])\]')
else:
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
@@ -1100,57 +960,29 @@ def findvideos(item):
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";'
item_local.url = scrapertools.find_single_match(data, patron)
if not item_local.url: #error
logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
#logger.debug("Patron: " + patron + " url: " + item_local.url)
#logger.debug(data)
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
rating = '' #Ponemos el rating
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
if item_local.contentType == "episode":
title = '%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
if item_local.infoLabels['temporada_num_episodios']:
title = '%s (de %s)' % (title, str(item_local.infoLabels['temporada_num_episodios']))
title = '%s %s' % (title, item_local.infoLabels['episodio_titulo'])
title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language), size)
else:
title = item_local.title
title_gen = title
title_gen = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title_gen).strip() #Quitamos etiquetas vacías
title_gen = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title_gen).strip() #Quitamos colores vacíos
title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen)
else:
title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen)
if config.get_setting("quit_channel_name", "videolibrary") == 1 and item_local.contentChannel == "videolibrary":
title_gen = '%s: %s' % (item_local.channel.capitalize(), title_gen)
itemlist.append(item_local.clone(title=title_gen)) #Título con todos los datos del vídeo
#Ahora pintamos el link del Torrent, si lo hay
if item_local.url: # Hay Torrent ?
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos etiquetas vacías
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos colores vacíos
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.server = "torrent" #Servidor
if size:
quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título
else:
quality = item_local.quality
itemlist.append(item_local.clone()) #Pintar pantalla
itemlist.append(item_local.clone(quality=quality)) #Pintar pantalla
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + title_gen + " / " + title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
#logger.debug(item_local)
# VER vídeos, descargar vídeos un link, o múltiples links
@@ -1236,7 +1068,7 @@ def findvideos(item):
if len(enlaces_descargar) > 0 and ver_enlaces_descargas != 0:
#Pintamos un pseudo-título de Descargas
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
if not item.unify: #Si Titulos Inteligentes NO seleccionados:
itemlist.append(item_local.clone(title="[COLOR gold]**- Enlaces Descargar: -**[/COLOR]", action=""))
else:
itemlist.append(item_local.clone(title="[COLOR gold] Enlaces Descargar: [/COLOR]", action=""))
@@ -1261,7 +1093,7 @@ def findvideos(item):
#Recorremos cada una de las partes. Vemos si el primer link está activo. Si no lo está ignoramos todo el enlace
p = 1
for enlace in partes:
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = "[COLOR yellow][%s][/COLOR] %s (%s/%s) [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
else:
parte_title = "[COLOR yellow]%s-[/COLOR] %s %s/%s [COLOR limegreen]-%s[/COLOR] [COLOR red]-%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
@@ -1303,12 +1135,12 @@ def findvideos(item):
break #Si se ha agotado el contador de verificación, se sale de "Enlace"
if item_local.alive == "??": #dudoso
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR yellow][?][/COLOR] %s' % (parte_title)
else:
parte_title = '[COLOR yellow]%s[/COLOR]-%s' % (item_local.alive, parte_title)
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR red][%s][/COLOR] %s' % (item_local.alive, parte_title)
else:
parte_title = '[COLOR red]%s[/COLOR]-%s' % (item_local.alive, parte_title)
@@ -1377,7 +1209,7 @@ def episodios(item):
list_pages = [item.url]
season = max_temp
if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas
if item.library_playcounts or item.tmdb_stat: #Comprobamos si realmente sabemos el num. máximo de temporadas
num_temporadas_flag = True
else:
num_temporadas_flag = False
@@ -1441,10 +1273,15 @@ def episodios(item):
if scrapertools.find_single_match(info, '\[\d{3}\]'):
info = re.sub(r'\[(\d{3}\])', r'[Cap.\1', info)
elif scrapertools.find_single_match(info, 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'):
pattern = 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'
elif scrapertools.find_single_match(info, '\[Cap.\d{2}_\d{2}\]'):
info = re.sub(r'\[Cap.(\d{2})_(\d{2})\]', r'[Cap.1\1_1\2]', info)
elif scrapertools.find_single_match(info, '\[Cap.([A-Za-z]+)\]'):
info = re.sub(r'\[Cap.([A-Za-z]+)\]', '[Cap.100]', info)
elif "completa" in info.lower():
info = info.replace("COMPLETA", "Caps. 01_99")
pattern = 'Temp.*?(?P<season>\d+).*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<quality>.*?)\].*?\[(?P<lang>\w+)\]?'
if scrapertools.find_single_match(info, '\[Cap.\d{2,3}'):
pattern = "\[(?P<quality>.*?)\].*?\[Cap.(?P<season>\d).*?(?P<episode>\d{2})(?:_(?P<season2>\d+)" \
"(?P<episode2>\d{2}))?.*?\].*?(?:\[(?P<lang>.*?)\])?"
@@ -1475,15 +1312,18 @@ def episodios(item):
except:
logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / " + str(match['episode2']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
if num_temporadas_flag and match['season'] != season and match['season'] > max_temp + 1:
#Si el num de temporada está fuera de control, se trata pone en num. de temporada actual
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
match['season'] = season
item_local.contentSeason = season
else:
item_local.contentSeason = match['season']
season = match['season']
num_temporadas_flag = True
if match['episode'] > 0:
num_temporadas_flag = True
if season > max_temp:
max_temp = season
@@ -1496,12 +1336,13 @@ def episodios(item):
item_local.infoLabels['episodio_titulo'] = match['lang']
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.contentEpisodeNumber = match['episode']
if match['episode'] == 0: match['episode'] = 1 #Evitar errores en Videoteca
if match["episode2"]: #Hay episodio dos? es una entrada múltiple?
item_local.title = "%sx%s al %s -" % (str(match["season"]), str(match["episode"]).zfill(2), str(match["episode2"]).zfill(2)) #Creamos un título con el rango de episodios
else: #Si es un solo episodio, se formatea ya
item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2))
item_local.contentEpisodeNumber = match['episode']
if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca
if item_local.contentSeason < max_temp:
@@ -1541,92 +1382,23 @@ def episodios(item):
# Pasada por TMDB y clasificación de lista por temporada y episodio
tmdb.set_infoLabels(itemlist, True)
# Pasada para maqullaje de los títulos obtenidos desde TMDB
num_episodios = 1
num_episodios_lista = []
for i in range(0, 50): num_episodios_lista += [0]
num_temporada = 1
num_temporada_max = 99
num_episodios_flag = True
for item_local in itemlist:
# Si no hay datos de TMDB, pongo los datos locales que conozco
if item_local.infoLabels['aired']:
item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Salvamos en número de episodios de la temporada
if item_local.infoLabels['number_of_seasons']:
#Si el num de temporada está fuera de control, se pone 0, y se reclasifica itemlist
if item_local.contentSeason > item_local.infoLabels['number_of_seasons'] + 1:
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(item_local.infoLabels['number_of_seasons']) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
else:
num_temporada_max = item_local.infoLabels['number_of_seasons']
else:
if item_local.contentSeason > num_temporada_max + 1:
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))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
if num_temporada != item_local.contentSeason:
num_temporada = item_local.contentSeason
num_episodios = 0
if item_local.infoLabels['temporada_num_episodios']:
num_episodios = item_local.infoLabels['temporada_num_episodios']
#Preparamos el título para que sea compatible con Añadir Serie a Videoteca
if item_local.infoLabels['episodio_titulo']:
if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName)
else:
item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo'])
if item_local.infoLabels['year']:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'])
if rating:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating)
else:
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating)
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language))
#Quitamos campos vacíos
item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "").strip()
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
if num_episodios < item_local.contentEpisodeNumber:
num_episodios = item_local.contentEpisodeNumber
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
item_local.infoLabels['temporada_num_episodios'] = num_episodios
num_episodios_flag = False
num_episodios_lista[item_local.contentSeason] = [num_episodios]
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
#logger.debug(item_local)
try:
if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie
for item_local in itemlist:
item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason]
except:
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))
if config.get_videolibrary_support() and len(itemlist) > 0:
title = ''
if item_local.infoLabels['temporada_num_episodios']:
title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios']
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]" + title, action="add_serie_to_library", extra="episodios"))
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
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 launcher.run(item)
def search(item, texto):
logger.info("search:" + texto)
+68 -296
View File
@@ -4,6 +4,7 @@ import re
import sys
import urllib
import urlparse
import datetime
from channelselector import get_thumb
from core import httptools
@@ -12,6 +13,7 @@ from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
from lib import generictools
host = 'http://www.tvsinpagar.com/'
@@ -145,11 +147,7 @@ def listado(item):
clase = "pelilist" # etiqueta para localizar zona de listado de contenidos
url_next_page ='' # Controlde paginación
cnt_tot = 30 # Poner el num. máximo de items por página
category = "" # Guarda la categoria que viene desde una busqueda global
if item.category:
category = item.category
del item.category
if item.totalItems:
del item.totalItems
@@ -258,8 +256,10 @@ def listado(item):
del item_local.tipo
if item_local.totalItems:
del item_local.totalItems
if item.post_num:
del item.post_num
if item_local.post_num:
del item_local.post_num
if item_local.category:
del item_local.category
item_local.title = ''
item_local.context = "['buscar_trailer']"
@@ -336,8 +336,8 @@ def listado(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("Espa", "").replace("Ingl", "").replace("Engl", "").replace("Calidad", "").replace("de la Serie", "")
title_alt = title_alt.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "").replace("Espa", "").replace("Ingl", "").replace("Engl", "").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", "")
title_alt = title_alt.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)
@@ -347,7 +347,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -403,65 +403,8 @@ def listado(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
if category == "newest": #Viene de Novedades. Marquemos el título con el nombre del canal
title += ' -%s-' % item_local.channel.capitalize()
if item_local.contentType == "movie":
item_local.contentTitle += ' -%s-' % item_local.channel.capitalize()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if len(itemlist) == 0:
itemlist.append(Item(channel=item.channel, action="mainlist", title="No se ha podido cargar el listado"))
@@ -728,7 +671,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("Esp", "").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("Ing", "").replace("Eng", "").replace("Calidad", "").replace("de la Serie", "")
#Limpiamos cabeceras y colas del título
title = re.sub(r'Descargar\s\w+\-\w+', '', title)
@@ -738,7 +681,7 @@ 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("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVB", "").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("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("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()
@@ -868,64 +811,8 @@ def listado_busqueda(item):
#Pasamos a TMDB la lista completa Itemlist
tmdb.set_infoLabels(itemlist, __modo_grafico__)
# Pasada para maquillaje de los títulos obtenidos desde TMDB
for item_local in itemlist:
title = item_local.title
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
if len(item_local.title_subs) > 0:
title += " "
for title_subs in item_local.title_subs:
if "audio" in title_subs.lower():
title = '%s [%s]' % (title, scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)'))
continue
if scrapertools.find_single_match(title_subs, r'(\d{4})'):
if not item_local.infoLabels['year'] or item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = scrapertools.find_single_match(title_subs, r'(\d{4})')
continue
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
title = '%s %s' % (title, title_subs)
else:
title = '%s -%s-' % (title, title_subs)
del item_local.title_subs
# Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = ''
# Preparamos el título para series, con los núm. de temporadas, si las hay
if item_local.contentType == "season" or item_local.contentType == "tvshow":
item_local.contentTitle= ''
title += " -Serie-"
elif item_local.extra == "varios":
title += " -Varios-"
item_local.contentTitle += " -Varios-"
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no
if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados:
if item_local.contentType == "season" or item_local.contentType == "tvshow":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, str(item_local.language))
elif item_local.contentType == "movie":
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados:
title = title.replace("[", "-").replace("]", "-")
title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip()
title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip()
item_local.title = title
logger.debug("url: " + item_local.url + " / title: " + item_local.title + " / content title: " + item_local.contentTitle + "/" + item_local.contentSerieName + " / calidad: " + item_local.quality + "[" + str(item_local.language) + "]" + " / year: " + str(item_local.infoLabels['year']))
#logger.debug(item_local)
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
if post:
itemlist.append(item.clone(channel=item.channel, action="listado_busqueda", title="[COLOR gold][B]Pagina siguiente >> [/B][/COLOR]" + str(post_num) + " de " + str(total_pag), thumbnail=get_thumb("next.png"), title_lista=title_lista, cnt_pag=cnt_pag))
@@ -1042,32 +929,7 @@ def findvideos(item):
verificar_enlaces_descargas = -1 #Verificar todos los enlaces Descargar
verificar_enlaces_descargas_validos = True #"¿Contar sólo enlaces 'verificados' en Descargar?"
excluir_enlaces_descargas = [] #Lista vacía de servidores excluidos en Descargar
# Saber si estamos en una ventana emergente lanzada desde una viñeta del menú principal,
# con la función "play_from_library"
unify_status = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
unify_status = config.get_setting("unify")
except:
unify_status = config.get_setting("unify")
#Salvamos la información de max num. de episodios por temporada para despues de TMDB
if item.infoLabels['temporada_num_episodios']:
num_episodios = item.infoLabels['temporada_num_episodios']
else:
num_episodios = 1
# Obtener la información actualizada del Episodio, si no la hay
if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'):
tmdb.set_infoLabels(item, __modo_grafico__)
elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary":
tmdb.set_infoLabels(item, __modo_grafico__)
#Restauramos la información de max num. de episodios por temporada despues de TMDB
if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']:
item.infoLabels['temporada_num_episodios'] = num_episodios
# Descarga la página
try:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
@@ -1081,17 +943,15 @@ def findvideos(item):
#Añadimos el tamaño para todos
size = scrapertools.find_single_match(data, '<div class="entry-left".*?><a href=".*?span class=.*?>Size:<\/strong>?\s(\d+?\.?\d*?\s\w[b|B])<\/span>')
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
if size:
item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
#Limpiamos de año y rating de episodios
if item.infoLabels['episodio_titulo']:
item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo'])
item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(item.wanted, '')
if item.infoLabels['aired'] and item.contentType == "episode":
item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})')
if not size:
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B])\]')
else:
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
@@ -1100,57 +960,29 @@ def findvideos(item):
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";'
item_local.url = scrapertools.find_single_match(data, patron)
if not item_local.url: #error
logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
#logger.debug("Patron: " + patron + " url: " + item_local.url)
#logger.debug(data)
#Pintamos el pseudo-título con toda la información disponible del vídeo
item_local.action = ""
item_local.server = "torrent"
rating = '' #Ponemos el rating
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
if item_local.contentType == "episode":
title = '%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
if item_local.infoLabels['temporada_num_episodios']:
title = '%s (de %s)' % (title, str(item_local.infoLabels['temporada_num_episodios']))
title = '%s %s' % (title, item_local.infoLabels['episodio_titulo'])
title_gen = '%s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (title, item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language), size)
else:
title = item_local.title
title_gen = title
title_gen = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title_gen).strip() #Quitamos etiquetas vacías
title_gen = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title_gen).strip() #Quitamos colores vacíos
title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen)
else:
title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen)
if config.get_setting("quit_channel_name", "videolibrary") == 1 and item_local.contentChannel == "videolibrary":
title_gen = '%s: %s' % (item_local.channel.capitalize(), title_gen)
itemlist.append(item_local.clone(title=title_gen)) #Título con todos los datos del vídeo
#Ahora pintamos el link del Torrent, si lo hay
if item_local.url: # Hay Torrent ?
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos etiquetas vacías
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title).strip() #Quitamos colores vacíos
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.alive = "??" #Calidad del link sin verificar
item_local.action = "play" #Visualizar vídeo
item_local.server = "torrent" #Servidor
if size:
quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título
else:
quality = item_local.quality
itemlist.append(item_local.clone()) #Pintar pantalla
itemlist.append(item_local.clone(quality=quality)) #Pintar pantalla
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + title_gen + " / " + title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / tamaño: " + size + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
#logger.debug(item_local)
# VER vídeos, descargar vídeos un link, o múltiples links
@@ -1236,7 +1068,7 @@ def findvideos(item):
if len(enlaces_descargar) > 0 and ver_enlaces_descargas != 0:
#Pintamos un pseudo-título de Descargas
if not unify_status: #Si Titulos Inteligentes NO seleccionados:
if not item.unify: #Si Titulos Inteligentes NO seleccionados:
itemlist.append(item_local.clone(title="[COLOR gold]**- Enlaces Descargar: -**[/COLOR]", action=""))
else:
itemlist.append(item_local.clone(title="[COLOR gold] Enlaces Descargar: [/COLOR]", action=""))
@@ -1261,7 +1093,7 @@ def findvideos(item):
#Recorremos cada una de las partes. Vemos si el primer link está activo. Si no lo está ignoramos todo el enlace
p = 1
for enlace in partes:
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = "[COLOR yellow][%s][/COLOR] %s (%s/%s) [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
else:
parte_title = "[COLOR yellow]%s-[/COLOR] %s %s/%s [COLOR limegreen]-%s[/COLOR] [COLOR red]-%s[/COLOR]" % (servidor.capitalize(), title, p, len(partes), item_local.quality, str(item_local.language))
@@ -1303,12 +1135,12 @@ def findvideos(item):
break #Si se ha agotado el contador de verificación, se sale de "Enlace"
if item_local.alive == "??": #dudoso
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR yellow][?][/COLOR] %s' % (parte_title)
else:
parte_title = '[COLOR yellow]%s[/COLOR]-%s' % (item_local.alive, parte_title)
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
if not unify_status: #Si titles Inteligentes NO seleccionados:
if not item.unify: #Si titles Inteligentes NO seleccionados:
parte_title = '[COLOR red][%s][/COLOR] %s' % (item_local.alive, parte_title)
else:
parte_title = '[COLOR red]%s[/COLOR]-%s' % (item_local.alive, parte_title)
@@ -1377,7 +1209,7 @@ def episodios(item):
list_pages = [item.url]
season = max_temp
if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas
if item.library_playcounts or item.tmdb_stat: #Comprobamos si realmente sabemos el num. máximo de temporadas
num_temporadas_flag = True
else:
num_temporadas_flag = False
@@ -1441,10 +1273,15 @@ def episodios(item):
if scrapertools.find_single_match(info, '\[\d{3}\]'):
info = re.sub(r'\[(\d{3}\])', r'[Cap.\1', info)
elif scrapertools.find_single_match(info, 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'):
pattern = 'Temp.*?(?P<season>\d+).*?\[(?P<quality>.*?)\].*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<lang>\w+)\]?'
elif scrapertools.find_single_match(info, '\[Cap.\d{2}_\d{2}\]'):
info = re.sub(r'\[Cap.(\d{2})_(\d{2})\]', r'[Cap.1\1_1\2]', info)
elif scrapertools.find_single_match(info, '\[Cap.([A-Za-z]+)\]'):
info = re.sub(r'\[Cap.([A-Za-z]+)\]', '[Cap.100]', info)
elif "completa" in info.lower():
info = info.replace("COMPLETA", "Caps. 01_99")
pattern = 'Temp.*?(?P<season>\d+).*?Cap\w?\.\s\d?(?P<episode>\d{2})(?:.*?(?P<episode2>\d{2}))?.*?\[(?P<quality>.*?)\].*?\[(?P<lang>\w+)\]?'
if scrapertools.find_single_match(info, '\[Cap.\d{2,3}'):
pattern = "\[(?P<quality>.*?)\].*?\[Cap.(?P<season>\d).*?(?P<episode>\d{2})(?:_(?P<season2>\d+)" \
"(?P<episode2>\d{2}))?.*?\].*?(?:\[(?P<lang>.*?)\])?"
@@ -1475,15 +1312,18 @@ def episodios(item):
except:
logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / " + str(match['episode2']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
if num_temporadas_flag and match['season'] != season and match['season'] > max_temp + 1:
#Si el num de temporada está fuera de control, se trata pone en num. de temporada actual
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern + " / MATCHES: " + str(matches))
#logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / PATRON: " + pattern)
match['season'] = season
item_local.contentSeason = season
else:
item_local.contentSeason = match['season']
season = match['season']
num_temporadas_flag = True
if match['episode'] > 0:
num_temporadas_flag = True
if season > max_temp:
max_temp = season
@@ -1496,12 +1336,13 @@ def episodios(item):
item_local.infoLabels['episodio_titulo'] = match['lang']
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.contentEpisodeNumber = match['episode']
if match['episode'] == 0: match['episode'] = 1 #Evitar errores en Videoteca
if match["episode2"]: #Hay episodio dos? es una entrada múltiple?
item_local.title = "%sx%s al %s -" % (str(match["season"]), str(match["episode"]).zfill(2), str(match["episode2"]).zfill(2)) #Creamos un título con el rango de episodios
else: #Si es un solo episodio, se formatea ya
item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2))
item_local.contentEpisodeNumber = match['episode']
if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca
if item_local.contentSeason < max_temp:
@@ -1541,92 +1382,23 @@ def episodios(item):
# Pasada por TMDB y clasificación de lista por temporada y episodio
tmdb.set_infoLabels(itemlist, True)
# Pasada para maqullaje de los títulos obtenidos desde TMDB
num_episodios = 1
num_episodios_lista = []
for i in range(0, 50): num_episodios_lista += [0]
num_temporada = 1
num_temporada_max = 99
num_episodios_flag = True
for item_local in itemlist:
# Si no hay datos de TMDB, pongo los datos locales que conozco
if item_local.infoLabels['aired']:
item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')
rating = ''
if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0':
rating = float(item_local.infoLabels['rating'])
rating = round(rating, 1)
#Salvamos en número de episodios de la temporada
if item_local.infoLabels['number_of_seasons']:
#Si el num de temporada está fuera de control, se pone 0, y se reclasifica itemlist
if item_local.contentSeason > item_local.infoLabels['number_of_seasons'] + 1:
logger.error("ERROR 07: EPISODIOS: Num. de Temporada fuera de rango " + " / TEMPORADA: " + str(item_local.contentSeason) + " / " + str(item_local.contentEpisodeNumber) + " / MAX_TEMPORADAS: " + str(item_local.infoLabels['number_of_seasons']) + " / LISTA_TEMPORADAS: " + str(num_episodios_lista))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
else:
num_temporada_max = item_local.infoLabels['number_of_seasons']
else:
if item_local.contentSeason > num_temporada_max + 1:
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))
item_local.contentSeason = 0
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber)))
if num_temporada != item_local.contentSeason:
num_temporada = item_local.contentSeason
num_episodios = 0
if item_local.infoLabels['temporada_num_episodios']:
num_episodios = item_local.infoLabels['temporada_num_episodios']
#Preparamos el título para que sea compatible con Añadir Serie a Videoteca
if item_local.infoLabels['episodio_titulo']:
if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName)
else:
item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo'])
if item_local.infoLabels['year']:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'])
if rating:
item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating)
else:
item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName)
item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating)
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language))
#Quitamos campos vacíos
item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "").strip()
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
if num_episodios < item_local.contentEpisodeNumber:
num_episodios = item_local.contentEpisodeNumber
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
item_local.infoLabels['temporada_num_episodios'] = num_episodios
num_episodios_flag = False
num_episodios_lista[item_local.contentSeason] = [num_episodios]
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
#logger.debug(item_local)
try:
if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie
for item_local in itemlist:
item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason]
except:
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))
if config.get_videolibrary_support() and len(itemlist) > 0:
title = ''
if item_local.infoLabels['temporada_num_episodios']:
title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios']
itemlist.append(item.clone(title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]" + title, action="add_serie_to_library", extra="episodios"))
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
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 launcher.run(item)
def search(item, texto):
logger.info("search:" + texto)
+5 -12
View File
@@ -149,7 +149,6 @@ def generos(item):
itemlist = []
data = httptools.downloadpage(item.url).data
data = re.sub(r'"|\n|\r|\t|&nbsp;|<br>|\s{2,}', "", data)
logger.debug(data)
patron = 'genres menu-item-.*?><a href=(.*?)>(.*?)<'
matches = re.compile(patron, re.DOTALL).findall(data)
@@ -201,13 +200,11 @@ def alpha(item):
url = 'https://www.ultrapeliculashd.com/wp-json/dooplay/glossary/?term=%s&nonce=4e850b7d59&type=all' % item.id
data = httptools.downloadpage(url).data
dict_data = jsontools.load(data)
logger.debug(dict_data)
for elem in dict_data:
logger.debug(dict_data[elem])
elem = dict_data[elem]
itemlist.append(Item(channel=item.channel, action='findvideos', title = elem['title'], url=elem['url'],
thumbnail=elem['img']))
if 'error' not in dict_data:
for elem in dict_data:
elem = dict_data[elem]
itemlist.append(Item(channel=item.channel, action='findvideos', title = elem['title'], url=elem['url'],
thumbnail=elem['img']))
return itemlist
@@ -216,19 +213,15 @@ def findvideos(item):
itemlist = []
data = httptools.downloadpage(item.url).data
data = re.sub(r'"|\n|\r|\t|&nbsp;|<br>|\s{2,}', "", data)
#logger.debug(data)
patron = '<iframe.*?rptss src=(.*?) (?:width.*?|frameborder.*?) allowfullscreen><\/iframe>'
matches = re.compile(patron, re.DOTALL).findall(data)
for video_url in matches:
logger.debug('video_url: %s' % video_url)
if 'stream' in video_url and 'streamango' not in video_url:
data = httptools.downloadpage('https:'+video_url).data
logger.debug(data)
if not 'iframe' in video_url:
new_url=scrapertools.find_single_match(data, 'iframe src="(.*?)"')
new_data = httptools.downloadpage(new_url).data
logger.debug('new_data %s' % new_data)
url= ''
try:
url, quality = scrapertools.find_single_match(new_data, 'file:.*?(?:\"|\')(https.*?)(?:\"|\'),'
+1 -2
View File
@@ -524,8 +524,7 @@ def mark_content_as_watched(item):
# Actualizar toda la serie
new_item = item.clone(contentSeason=-1)
mark_season_as_watched(new_item)
if config.is_xbmc() and item.contentType == 'episode':
if config.is_xbmc(): #and item.contentType == 'episode':
from platformcode import xbmc_videolibrary
xbmc_videolibrary.mark_content_as_watched_on_kodi(item, item.playcount)
+2 -1
View File
@@ -69,7 +69,8 @@ def list_all(item):
action = 'seasons'
if 'episode' in item.url:
scrapedtitle, season, episode = scrapertools.find_single_match(scrapedtitle, '(.*?) (\d+)x(\d+)')
scrapedtitle, season, episode = scrapertools.find_single_match(scrapedtitle,
'(.*?) (\d+).*?(?:x|X).*?(\d+)')
contentSerieName = scrapedtitle
scrapedtitle = '%sx%s - %s' % (season, episode, scrapedtitle)
action='findvideos'