diff --git a/mediaserver/COMO INSTALAR.txt b/mediaserver/COMO INSTALAR.txt new file mode 100644 index 00000000..48d5bd3f --- /dev/null +++ b/mediaserver/COMO INSTALAR.txt @@ -0,0 +1,24 @@ +Esta versión de Alfa no necesita de ningún programa para instalar (tampoco kodi), es una versión independiente que solo necesita un navegador web y un equipo (en el cual será instalado) para ver el contenido desde cualquier dispositivo que cuente con un navegador web. + +REQUISITOS: + +Se necesita que esté instalado python 2.x desde aqui: https://www.python.org/ + +COMO INSTALAR LA VERSION MEDIASERVER: + +-Descargar Alfa desde el reposotorio de Github: https://github.com/alfa-addon/addon (opcion Clone or download - Download zip +-El archivo descargado (addon-master.zip) abrirlo e ingresar a la carpeta: addon-master +-Descomprimir la carpeta plugin.video.alfa en alguna carpeta +-Luego descomprimir la carpeta mediaserver encima de la carpeta plugi.video.alfa reemplazando los archivos existentes. + +COMO INICIAR LA VERSION MEDIASERVER + +Para iniciar: python alfa.py + +Y mostrará en pantalla la url a la cual se puede conectar desde cualquier dispositivo que contenga un navegador web. + +Ejemplo: + +http://192.168.1.10:8080 + + diff --git a/mediaserver/IMPORTANTE LEEME en esta version.txt b/mediaserver/IMPORTANTE LEEME en esta version.txt deleted file mode 100644 index 5a9a151e..00000000 --- a/mediaserver/IMPORTANTE LEEME en esta version.txt +++ /dev/null @@ -1,2 +0,0 @@ -Debe ejecutar primero el archivo "script.py", si no lo hizo antes. -Una vez realizado el proceso podrá ejecutar como siempre "alfa.py" para iniciar el addon. \ No newline at end of file diff --git a/mediaserver/platformcode/config.py b/mediaserver/platformcode/config.py index 832bc738..12b0c80b 100644 --- a/mediaserver/platformcode/config.py +++ b/mediaserver/platformcode/config.py @@ -310,6 +310,23 @@ def verify_directories_created(): logger.debug("Creating %s: %s" % (path, saved_path)) filetools.mkdir(saved_path) + config_paths = [["folder_movies", "CINE"], + ["folder_tvshows", "SERIES"]] + + for path, default in config_paths: + saved_path = get_setting(path) + + if not saved_path: + saved_path = default + set_setting(path, saved_path) + + content_path = filetools.join(get_videolibrary_path(), saved_path) + if not filetools.exists(content_path): + logger.debug("Creating %s: %s" % (path, content_path)) + + # si se crea el directorio + filetools.mkdir(content_path) + def get_local_ip(): import socket @@ -372,6 +389,7 @@ if not os.path.exists(get_data_path()): TRANSLATION_FILE_PATH = os.path.join(get_runtime_path(), "resources", "language", "Spanish", "strings.po") load_settings() + # modo adulto: # sistema actual 0: Nunca, 1:Siempre, 2:Solo hasta que se reinicie sesión # si es == 2 lo desactivamos. diff --git a/mediaserver/platformcode/launcher.py b/mediaserver/platformcode/launcher.py index 9a5f551c..9f223346 100644 --- a/mediaserver/platformcode/launcher.py +++ b/mediaserver/platformcode/launcher.py @@ -40,6 +40,7 @@ def run(item): platformtools.render_items(None, item) return + channelmodule = None # Importa el canal para el item, todo item debe tener un canal, sino sale de la función if item.channel: channelmodule = import_channel(item) diff --git a/mediaserver/platformcode/template/css/alfa.css b/mediaserver/platformcode/template/css/alfa.css index 500e1ed8..0cbc53dd 100644 --- a/mediaserver/platformcode/template/css/alfa.css +++ b/mediaserver/platformcode/template/css/alfa.css @@ -131,9 +131,12 @@ div.header { } div.header > div.logo { float: left; - height: 50px; - width: 70px; - background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2270px%22%20height%3D%2250px%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Crect%20fill%3D%22%2391D9E8%22%20stroke%3D%22%2301455C%22%20stroke-width%3D%221%22%20x%3D%229%22%20y%3D%2215%22%20width%3D%2240.4%22%20height%3D%2226.5%22%2F%3E%0A%3Crect%20fill%3D%22%2303BFEC%22%20stroke%3D%22%2301455C%22%20stroke-width%3D%221%22%20x%3D%226%22%20y%3D%229%22%20width%3D%2210.8%22%20height%3D%229.3%22%20rx%3D%222%22%20ry%3D%222%22%2F%3E%0A%3Crect%20fill%3D%22%2303BFEC%22%20stroke%3D%22%2301455C%22%20stroke-width%3D%221%22%20x%3D%2237%22%20y%3D%2235%22%20width%3D%2215.5%22%20height%3D%2212.4%22%20rx%3D%222%22%20ry%3D%222%22%2F%3E%0A%3Crect%20fill%3D%22%2300ABE3%22%20stroke%3D%22%2301455C%22%20stroke-width%3D%221%22%20x%3D%2233%22%20y%3D%222%22%20width%3D%2234.2%22%20height%3D%2225%22%20rx%3D%222%22%20ry%3D%222%22%2F%3E%0A%3Crect%20fill%3D%22%2303BFEC%22%20stroke%3D%22%2301455C%22%20stroke-width%3D%221%22%20x%3D%223%22%20y%3D%2227%22%20width%3D%2224.8%22%20height%3D%2217%22%20rx%3D%222%22%20ry%3D%222%22%2F%3E%0A%3C%2Fsvg%3E"); + height: 45px; + width: 60px; + margin-left: 15px; + margin-top: 2px; + background-repeat: no-repeat; + background-image: url("https://github.com/alfa-addon/addon/raw/master/mediaserver/platformcode/template/logo-mediaserver.png"); } div.header > a.settings:after { @@ -1303,4 +1306,4 @@ ul.itemlist > li.item_list > a.item > h3.label { padding-top: 0px; left: 0px; right: 0px; -} \ No newline at end of file +} diff --git a/mediaserver/platformcode/template/favicon.ico b/mediaserver/platformcode/template/favicon.ico index 1cad56c7..639eeb64 100644 Binary files a/mediaserver/platformcode/template/favicon.ico and b/mediaserver/platformcode/template/favicon.ico differ diff --git a/mediaserver/platformcode/template/logo-mediaserver.png b/mediaserver/platformcode/template/logo-mediaserver.png new file mode 100644 index 00000000..152b3864 Binary files /dev/null and b/mediaserver/platformcode/template/logo-mediaserver.png differ diff --git a/mediaserver/script.py b/mediaserver/script.py deleted file mode 100644 index 5936fd82..00000000 --- a/mediaserver/script.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- -import os -import re -import shutil - -from platformcode import config, logger, platformtools - - -def conversion(): - logger.info() - data = "" - - try: - # do a backup - path_settings = os.path.join(config.get_data_path(), "settings.xml") - path_settings_backup = os.path.join(config.get_data_path(), "settings.backup.xml") - shutil.copy(path_settings, path_settings_backup) - - # open file - f = open(path_settings, "r") - # copy = open(path_settings2, "w") - - logger.info(" ---") - logger.info(" --- 1") - logger.info(" --- 2") - logger.info(" --- 3") - data_aux = "" - - begin_tag = "\n" - end_tag = "\n" - - adult_data = ' \n' - adult_data += ' \n' - adult_data += ' \n' - adult_data += ' \n' - adult_data += ' \n' - adult_data += ' \n' - - for line in f: - matches = re.findall(' tag - # data += line - else: - logger.info("Matches") - for _id, value in matches: - logger.info(" dentro del for") - logger.info(" _id:%s value:%s" % (_id, value)) - - if _id not in ["adult_aux_intro_password", "adult_aux_new_password1", "adult_aux_new_password2", - "adult_mode", "adult_password", "adult_request_password", "adult_pin"]: - logger.info(" linea %s" % line) - logger.info(" value %s" % value) - if value: - # logger.info(" type value!! %s" % type(value)) - logger.info(" antes value!! %s" % value) - if "(str, " in value: - if "(str, '" in value: - value = value.replace("(str, '", "") - value = value.replace("')", "") - elif "(str, '": - value = value.replace("(str, '", "") - value = value.replace("')", "") - elif "(bool, " in value: - value = value.replace("(bool, ", "") - if value == "True)": - value = "true" - else: - value = "false" - value = value.replace('\\\\', '\\') - logger.info(" despues value!! %s" % value) - - aux_line = '\n' % (_id, value) - logger.info(" aux_line %s" % aux_line) - data_aux += " " + aux_line - f.close() - - data = begin_tag + adult_data + data_aux + end_tag - - copy_file = open(path_settings, "w") - copy_file.write(data) - copy_file.close() - - while True: - import sys - logger.info("sys ve %s" % sys.version_info) - if sys.version_info > (3, 0): - value = input("Alfa\nCorregido un error en la seccion adultos, se ha reseteado la contrasena a por " - "defecto, tendra que cambiarla de nuevo si lo desea.\n Escriba 's', si lo ha entendido: ") - else: - value = raw_input("Alfa\nCorregido un error en la seccion adultos, se ha reseteado la contrasena a por " - "defecto, tendra que cambiarla de nuevo si lo desea.\n Escriba 's', si lo ha entendido: ") - logger.debug("value %s" % value) - if value.lower() == 's': - break - logger.info("En disclaimer clickó 'No'") - - logger.info("En disclaimer clickó 'Si'") - - except Exception, ex: - template = "An exception of type %s occured. Arguments:\n%r" - message = template % (type(ex).__name__, ex.args) - logger.info(message) - print("Alfa", "Error, en conversión") - logger.info("Datos a guardar %s" % data) - -if __name__ == "__main__": - conversion() diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index fe136a21..f9207650 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -1,5 +1,5 @@ - + @@ -22,12 +22,14 @@ » grantorrent » descargas2020 » torrentlocura » torrentrapid » tumejortorrent » tvsinpagar - » mispelisyseries » kbagi - » animemovil » pelismagnet - » pelisultra » seriesdanko - » seriespapaya » seriesverde - » ultrapeliculas » wikiseries - ¤ arreglos internos + » mispelisyseries » playview + » clipwatching » cloudvideo + » filevideo » upvid + » vidzella » vivo + » watchvideo » vshare + ¤ arreglos internos y actualizado la versión mediaserver + + ¤ Agradecimientos a @alaquepasa y @Pixo506 por colaborar con ésta versión. Navega con Kodi por páginas web para ver sus videos de manera fácil. diff --git a/plugin.video.alfa/channels/descargas2020.py b/plugin.video.alfa/channels/descargas2020.py index 01aed6bb..98e005c6 100644 --- a/plugin.video.alfa/channels/descargas2020.py +++ b/plugin.video.alfa/channels/descargas2020.py @@ -5,6 +5,7 @@ import sys import urllib import urlparse import datetime +import ast from channelselector import get_thumb from core import httptools @@ -17,15 +18,34 @@ from lib import generictools host = 'http://descargas2020.com/' +#Código para permitir usar un único canal para todas las webs clones de NewPct1 +clone_list = config.get_setting('clonenewpct1_channels_list', "torrentrapid") #Carga lista de clones +clone_list = ast.literal_eval(clone_list) #la convierte a lista de tuplas +host_index = 0 +host_index = config.get_setting('clonenewpct1_channel_default', "torrentrapid") #Clone por defecto +i = 0 +for active_clone, channel_clone, host_clone, contentType_clone, info_clone in clone_list: + if i == host_index: + #channel_clone_name = channel_clone #ACTIVAR CUANDO SE PASE A NEWPCT1 + #host = 'http://%s/' % host_clone #ACTIVAR CUANDO SE PASE A NEWPCT1 + i += 1 + +#Carga de opciones del canal item = Item() if not item.channel: item.channel = scrapertools.find_single_match(host, r'(\w+)\.com\/') +channel_clone_name = scrapertools.find_single_match(host, r'(\w+)\.com\/') #QUITAR CUANDO SE PASE A NEWPCT1 __modo_grafico__ = config.get_setting('modo_grafico', item.channel) modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', item.channel) + def mainlist(item): logger.info() + #Renombramos el canal al nombre de clone elegido + item.channel = channel_clone_name + if item.category: item.category = channel_clone_name.capitalize() + itemlist = [] thumb_pelis = get_thumb("channels_movie.png") @@ -64,20 +84,40 @@ def settingCanal(item): def submenu(item): logger.info() itemlist = [] - + try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) - itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) - return itemlist #Algo no funciona, pintamos lo que tenemos - data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") - data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com - + pass + + host_alt = host host_dom = host.replace("https://", "").replace("http://", "").replace("www.", "") patron = '
  • .*?(.*?)' - if "pelisyseries.com" in host and item.extra == "varios": #compatibilidad con mispelisy.series.com - data = ' Documentales' + #Verificamos si se ha cargado una página, y si además tiene la estructura correcta + if not data or not scrapertools.find_single_match(data, patron): + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) + #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú + item, data = generictools.fail_over_newpct1(item, patron) + + if not data: #Si no ha logrado encontrar nada, salimos + itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + elif item.channel_alt: #Si ha habido fail-over, lo comento + itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR] [ALT ] en uso')) + itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel_alt.capitalize() + '[/COLOR] caído')) + + host_alt = host.replace(item.channel_alt, item.channel) + del item.channel_alt + if item.url_alt: del item.url_alt + + #data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") + #data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com + + host_dom = host_alt.replace("https://", "").replace("http://", "").replace("www.", "") + patron = '
  • .*?(.*?)' + if "pelisyseries.com" in host_alt and item.extra == "varios": #compatibilidad con mispelisy.series.com + data = ' Documentales' else: if data: data = scrapertools.get_match(data, patron) @@ -104,10 +144,10 @@ def submenu(item): Item(channel=item.channel, action="alfabeto", title=title + " [A-Z]", url=url, extra=item.extra)) if item.extra == "peliculas": - itemlist.append(Item(channel=item.channel, action="listado", title="Películas 4K", url=host + "peliculas-hd/4kultrahd/", extra=item.extra)) + itemlist.append(Item(channel=item.channel, action="listado", title="Películas 4K", url=host_alt + "peliculas-hd/4kultrahd/", extra=item.extra)) itemlist.append( - Item(channel=item.channel, action="alfabeto", title="Películas 4K" + " [A-Z]", url=host + "peliculas-hd/4kultrahd/", extra=item.extra)) - + Item(channel=item.channel, action="alfabeto", title="Películas 4K" + " [A-Z]", url=host_alt + "peliculas-hd/4kultrahd/", extra=item.extra)) + return itemlist @@ -203,7 +243,8 @@ def listado(item): #logger.debug("patron: " + patron + " / fichas: " + fichas) # Identifico la página actual y el total de páginas para el pie de página - total_pag = scrapertools.find_single_match(data,'Last<\/a><\/li>') + patron_last_page = 'Last<\/a><\/li>' + total_pag = scrapertools.find_single_match(data, patron_last_page) if not item.post_num: post_num = 1 @@ -419,6 +460,9 @@ def listado(item): def listado_busqueda(item): logger.info() + + host = 'http://%s/' % scrapertools.find_single_match(item.url, '(\w+\.com)\/') + itemlist = [] cnt_tot = 40 # Poner el num. máximo de items por página. Dejamos que la web lo controle cnt_title = 0 # Contador de líneas insertadas en Itemlist @@ -449,17 +493,24 @@ def listado_busqueda(item): #Máximo num. de líneas permitidas por TMDB. Máx de 5 páginas por Itemlist para no degradar el rendimiento while cnt_title <= cnt_tot and cnt_next < 5: + pattern = '
      (.*?)
    ' % item.pattern #seleccionamos el bloque que nos interesa try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, post=item.post).data) except: - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) - itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - cnt_next += 1 - if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) + pass + + cnt_next += 1 + if not data or not scrapertools.find_single_match(data, pattern): + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + item.post + " / DATA: " + data) + #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú + item, data = generictools.fail_over_newpct1(item, pattern) + + if not data: #Si no ha logrado encontrar nada, salimos + itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + elif item.channel_alt: #Si ha habido fail-over, lo comento + host = host.replace(item.channel_alt, item.channel) #Obtiene la dirección de la próxima página, si la hay try: @@ -824,6 +875,11 @@ def listado_busqueda(item): def findvideos(item): from core import channeltools logger.info() + + #Renombramos el canal al nombre de clone elegido + item.channel = channel_clone_name + if item.category: item.category = channel_clone_name.capitalize() + itemlist = [] # Cualquiera de las tres opciones son válidas @@ -934,9 +990,20 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: + pass + + patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent + #Verificamos si se ha cargado una página, y si además tiene la estructura correcta + if not data or not scrapertools.find_single_match(data, patron): logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) + + #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo + item, data = generictools.fail_over_newpct1(item, patron) + if not data: #Si no ha logrado encontrar nada, salimos + itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures") @@ -948,6 +1015,8 @@ def findvideos(item): 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 + if size: + size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b') 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 @@ -957,7 +1026,6 @@ def findvideos(item): item_local = item.clone() # obtenemos la url torrent - 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: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) @@ -969,17 +1037,17 @@ def findvideos(item): #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 + if size: + quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título + else: + quality = item_local.quality + item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (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.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(quality=quality)) #Pintar pantalla 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) @@ -1163,9 +1231,20 @@ def findvideos(item): def episodios(item): logger.info() + + #Renombramos el canal al nombre de clone elegido + item.channel = channel_clone_name + if item.category: item.category = channel_clone_name.capitalize() + itemlist = [] + # Obtener la información actualizada de la Serie. TMDB es imprescindible para Videoteca + if not item.infoLabels['tmdb_id']: + tmdb.set_infoLabels(item, True) + max_temp = 1 + if item.infoLabels['number_of_seasons']: + max_temp = item.infoLabels['number_of_seasons'] y = [] if modo_ultima_temp and item.library_playcounts: #Averiguar cuantas temporadas hay en Videoteca patron = 'season (\d+)' @@ -1173,16 +1252,30 @@ def episodios(item): for x in matches: y += [int(x)] max_temp = max(y) - - # Obtener la información actualizada de la Serie. TMDB es imprescindible para Videoteca - if not item.infoLabels['tmdb_id']: - tmdb.set_infoLabels(item, True) - + data = '' try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) - except: #Algún error de proceso, salimos - logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) + patron = '
      (.*?)
    ' % "buscar-list" # item.pattern + data_alt = '' + if data: data_alt = scrapertools.get_match(data, patron) + except: #Algún error de proceso + pass + + if "pelisyseries.com" in item.url: + pattern = ']*>
    ]+>(?P.*?)?<\/h3>.*?<\/li>' + else: + pattern = ']*>]+>(?P.*?)?<\/h2>' + + #Verificamos si se ha cargado una página, y si además tiene la estructura correcta + if not data_alt or not scrapertools.find_single_match(data_alt, pattern): + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea: " + item.url) + + #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo + item, data = generictools.fail_over_newpct1(item, patron, pattern) + + if not data: #No se ha encontrado ningún canal activo para este vídeo + itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist @@ -1209,7 +1302,8 @@ def episodios(item): list_pages = [item.url] season = max_temp - if item.library_playcounts or item.tmdb_stat: #Comprobamos si realmente sabemos el num. máximo de temporadas + #Comprobamos si realmente sabemos el num. máximo de temporadas + if item.library_playcounts or (item.infoLabels['number_of_seasons'] and item.tmdb_stat): num_temporadas_flag = True else: num_temporadas_flag = False @@ -1226,11 +1320,11 @@ def episodios(item): if not data: raise except: - logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + data) + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + str(data)) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - if "pelisyseries.com" in host: + if "pelisyseries.com" in item.url: pattern = ']*>
    ]+>(?P.*?)?<\/h3>.*?<\/li>' else: pattern = ']*>]+>(?P.*?)?<\/h2>' @@ -1245,7 +1339,7 @@ def episodios(item): #Empezamos a generar cada episodio for url, thumb, info in matches: - if "pelisyseries.com" in host: #En esta web están en diferente orden + if "pelisyseries.com" in item.url: #En esta web están en diferente orden interm = url url = thumb thumb = interm @@ -1273,6 +1367,10 @@ 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\d+).*?[c|C]ap.*?\.(?P\d+)?.*?(?:(?P\d+))\]?\[(?P\w+)?(?P\w+)\]?'): + pattern = 'Temp.*?(?P\d+).*?[c|C]ap.*?\.(?P\d+)?.*?(?:(?P\d+))\]?\[(?P\w+)?(?P\w+)\]?' + elif scrapertools.find_single_match(info, 'Temp.*?(?P\d+).*?\[(?P.*?)\].*?(?P\d{2})?(?:.*?(?P\d{2}))?.*?(?P\[\w+.*)\[.*?\]?'): + pattern = 'Temp.*?(?P\d+).*?\[(?P.*?)\].*?(?P\d{2})?(?:.*?(?P\d{2}))?.*?(?P\[\w+.*)\[.*?\]?' elif scrapertools.find_single_match(info, 'Temp.*?(?P\d+).*?\[(?P.*?)\].*?Cap\w?\.\s\d?(?P\d{2})(?:.*?(?P\d{2}))?.*?\[(?P\w+)\]?'): pattern = 'Temp.*?(?P\d+).*?\[(?P.*?)\].*?Cap\w?\.\s\d?(?P\d{2})(?:.*?(?P\d{2}))?.*?\[(?P\w+)\]?' elif scrapertools.find_single_match(info, '\[Cap.\d{2}_\d{2}\]'): @@ -1312,11 +1410,9 @@ 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) + " / 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) + 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)) match['season'] = season item_local.contentSeason = season else: @@ -1331,11 +1427,11 @@ def episodios(item): item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie item_local.quality = item_local.quality.replace("ALTA DEFINICION", "HDTV") - if match['lang'] and estado == False: - match['lang'] = match['lang'].replace("- ", "") + if match['lang'] and (estado == False or "especia" in str(match['lang']).lower()): + match['lang'] = match['lang'].replace("- ", "").replace("[", "").replace("]", "") 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 @@ -1381,6 +1477,8 @@ def episodios(item): # Pasada por TMDB y clasificación de lista por temporada y episodio tmdb.set_infoLabels(itemlist, True) + + #logger.debug(item) #Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB item, itemlist = generictools.post_tmdb_episodios(item, itemlist) @@ -1395,7 +1493,7 @@ def actualizar_titulos(item): 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) @@ -1403,6 +1501,9 @@ def actualizar_titulos(item): def search(item, texto): logger.info("search:" + texto) # texto = texto.replace(" ", "+") + + item.channel = channel_clone_name + if item.category: item.category = channel_clone_name.capitalize() try: item.post = "q=%s" % texto diff --git a/plugin.video.alfa/channels/elitetorrent.py b/plugin.video.alfa/channels/elitetorrent.py index 42e69560..235a7c40 100644 --- a/plugin.video.alfa/channels/elitetorrent.py +++ b/plugin.video.alfa/channels/elitetorrent.py @@ -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 = 'http://www.elitetorrent.biz' @@ -39,7 +40,12 @@ def submenu(item): logger.info() itemlist = [] - data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) + return itemlist #Algo no funciona, pintamos lo que tenemos patron = '
    .*?<\/div>' #Menú principal data1 = scrapertools.get_match(data, patron) @@ -48,6 +54,10 @@ def submenu(item): patron = ')", "", httptools.downloadpage(item.url).data) - + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + if not data: #Si la web está caída salimos sin dar error + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + patron = '
    .*?<\/nav><\/div><\/div>' data = scrapertools.find_single_match(data, patron) @@ -90,6 +109,11 @@ def listado(item): patron += '="dig2">(.*?)<\/span><\/div>' #tipo tamaño matches = re.compile(patron, re.DOTALL).findall(data) + if not matches and not '503 Backend fetch failed' in data: #error + logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log')) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + #logger.debug("PATRON: " + patron) #logger.debug(matches) #logger.debug(data) @@ -102,7 +126,7 @@ def listado(item): item_local.url = urlparse.urljoin(host, scrapedurl) item_local.thumbnail = urlparse.urljoin(host, scrapedthumbnail) - if "---" in scrapedcalidad: #Scrapeamos y limpiamos calidades + if "---" in scrapedcalidad: #limpiamos calidades scrapedcalidad = '' if "microhd" in title.lower(): item_local.quality = "microHD" @@ -137,13 +161,18 @@ def listado(item): if item_local.extra == "peliculas": #preparamos Item para películas if "/serie" in scrapedurl or "/serie" in item.url: continue + if not "/serie" in scrapedurl and not "/serie" in item.url: item_local.contentType = "movie" - item_local.contentTitle = title.strip() - else: #preparamos Item para series + item_local.contentTitle = title + item_local.extra = "peliculas" + + if item_local.extra == "series": #preparamos Item para series if not "/serie" in scrapedurl and not "/serie" in item.url: continue + if "/serie" in scrapedurl or "/serie" in item.url: item_local.contentType = "episode" - epi_mult = scrapertools.find_single_match(item_local.url, r'cap.*?-\d+-(al-\d+)') + item_local.extra = "series" + epi_mult = scrapertools.find_single_match(item_local.url, r'cap.*?-\d+-al-(\d+)') item_local.contentSeason = scrapertools.find_single_match(item_local.url, r'temp.*?-(\d+)') item_local.contentEpisodeNumber = scrapertools.find_single_match(item_local.url, r'cap.*?-(\d+)') if not item_local.contentSeason: @@ -154,87 +183,35 @@ def listado(item): item_local.contentSeason = 1 if item_local.contentEpisodeNumber < 1: item_local.contentEpisodeNumber = 1 - item_local.contentSerieName = title.strip() + item_local.contentSerieName = title if epi_mult: - title = '%s, %s' % (epi_mult.replace("-", " "), title) + title = "%sx%s al %s -" % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2), str(epi_mult).zfill(2)) #Creamos un título con el rango de episodios + else: + title = '%sx%s ' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2)) item_local.action = "findvideos" item_local.title = title.strip() item_local.infoLabels['year'] = "-" + #Pasamos a TMDB cada Item, para evitar el efecto memoria de tmdb + if item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global, pasamos + tmdb.set_infoLabels(item_local, True) + itemlist.append(item_local.clone()) #Pintar pantalla + #if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global + # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo + #Pasamos a TMDB la lista completa Itemlist - tmdb.set_infoLabels(itemlist, True) + #tmdb.set_infoLabels(itemlist, True) - # 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" or item_local.contentType == "tvshow": - item_local.contentTitle= '' - if item_local.contentType == "episode": - if scrapertools.find_single_match(title, r'(al\s\d+)'): - item_local.infoLabels['episodio_titulo'] = scrapertools.find_single_match(title, r'(al\s\d+)') - if scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'): - 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) - - #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 == "episode": - if item_local.infoLabels['episodio_titulo']: - title = '%sx%s %s, %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2), item_local.infoLabels['episodio_titulo'], item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language)) - else: - title = '%sx%s %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2), item_local.contentSerieName, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language)) - item_local.infoLabels['title'] = item_local.contentSerieName - - elif item_local.contentType == "season" or item_local.contentType == "tvshow": - if item_local.extra == "series": - title = '%s - Temporada %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.contentSerieName, item_local.contentSeason, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language)) - else: - title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.contentSerieName, item_local.infoLabels['year'], 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: - if item_local.contentType == "episode": - if item_local.infoLabels['episodio_titulo']: - item_local.infoLabels['episodio_titulo'] = '%s, %s [%s] [%s]' % (item_local.infoLabels['episodio_titulo'], 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.contentSerieName - - elif item_local.contentType == "season" or item_local.contentType == "tvshow": - if item_local.extra == "series": - title = '%s - Temporada %s [%s] [%s]' % (item_local.contentSerieName, item_local.contentSeason, item_local.infoLabels['year'], rating) - else: - title = '%s' % (item_local.contentSerieName) - - item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip() - 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 + " / year: " + str(item_local.infoLabels['year'])) + #Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB + item, itemlist = generictools.post_tmdb_listado(item, itemlist) # Extrae el paginador patron = '
    .*?)", "", httptools.downloadpage(item.url).data) - - patron = '
    .*?<\/nav><\/div><\/div>' - data = scrapertools.find_single_match(data, patron) - - patron = '
  • .*?)", "", httptools.downloadpage(item.url).data) + #Bajamos los datos de la página + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #data = unicode(data, "utf-8", errors="replace") #Añadimos el tamaño para todos size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B]s)\]') - item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]s\]', '', item.quality) #Quitamos size de calidad, si lo traía if size: item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]s\]', '', 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('\s\[\d+,?\d*?\s\w[b|B]s\]', '', item.quality) #Quitamos size de calidad, si lo traía + item.quality = '%s [%s]' % (item.quality, size) #Agregamos size al final de calidad + item.quality = item.quality.replace("G", "G ").replace("M", "M ") #Se evita la palabra reservada en Unify - #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']) - if item.infoLabels['episodio_titulo'] == item.contentSerieName: - item.infoLabels['episodio_titulo'] = '' - if item.infoLabels['aired'] and item.contentType == "episode": - item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})') - - #Generamos una copia de Item para trabajar sobre ella - item_local = item.clone() - - patron = '
    >": itemlist.pop() diff --git a/plugin.video.alfa/channels/grantorrent.py b/plugin.video.alfa/channels/grantorrent.py index f2534bd9..e4e4de76 100644 --- a/plugin.video.alfa/channels/grantorrent.py +++ b/plugin.video.alfa/channels/grantorrent.py @@ -286,20 +286,20 @@ def listado(item): title = title.replace("Dual", "").replace("dual", "").replace("Subtitulada", "").replace("subtitulada", "").replace("Subt", "").replace("subt", "").replace("Sub", "").replace("sub", "").replace("(Reparado)", "").replace("(Proper)", "").replace("(proper)", "").replace("Proper", "").replace("proper", "").replace("(Latino)", "").replace("Latino", "") title = title.replace("- HDRip", "").replace("(HDRip)", "").replace("- Hdrip", "").replace("(microHD)", "").replace("(DVDRip)", "").replace("(HDRip)", "").replace("(BR-LINE)", "").replace("(HDTS-SCREENER)", "").replace("(BDRip)", "").replace("(BR-Screener)", "").replace("(DVDScreener)", "").replace("TS-Screener", "").replace(" TS", "").replace(" Ts", "") - if item_local.extra == "peliculas": #preparamos Item para películas + if item_local.extra == "peliculas": #preparamos Item para películas if "/serie" in scrapedurl or "/serie" in item.url: continue item_local.contentType = "movie" item_local.action = "findvideos" - title = scrapertools.htmlclean(title) #Quitamos html restante + title = scrapertools.htmlclean(title) #Quitamos html restante item_local.contentTitle = title.strip() - else: #preparamos Item para series + else: #preparamos Item para series if not "/serie" in scrapedurl and not "/serie" in item.url: continue - if modo_serie_temp == 1: #si está en modo Serie + if modo_serie_temp == 1: #si está en modo Serie item_local.contentType = "tvshow" item_local.extra = "tvshow" - else: #si no, en modo temporada + else: #si no, en modo temporada item_local.contentType = "season" item_local.extra = "season" item_local.action = "episodios" @@ -378,6 +378,7 @@ def findvideos(item): if item.contentType == "episode": #En Series los campos están en otro orden. No hay size, en su lugar sxe temp_epi = quality quality = size + size = '' contentSeason = '' contentEpisodeNumber = '' try: #obtenemos la temporada y episodio de la página y la comparamos con Item @@ -423,17 +424,11 @@ def findvideos(item): item_local.quality = quality if "temporada" in temp_epi.lower(): item_local.quality = '%s [Temporada]' % item_local.quality - if size and item_local.contentType != "episode": + #if size and item_local.contentType != "episode": + if size: size = size.replace(".", ",").replace("B,", " B").replace("b,", " b") item_local.quality = '%s [%s]' % (item_local.quality, size) - - #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})') - + #Salvamos la url del .torrent if scrapedurl: item_local.url = scrapedurl @@ -446,7 +441,7 @@ def findvideos(item): itemlist.append(item_local.clone()) #Pintar pantalla - logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.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 @@ -495,14 +490,14 @@ def episodios(item): matches = re.compile(patron, re.DOTALL).findall(str(item.library_playcounts)) max_temp = int(max(matches)) - if not item.library_playcounts: #no viene de Videoteca, se ponen valores de configuración o de la pasada anterior + if not item.library_playcounts: #no viene de Videoteca, se ponen valores de configuración o de la pasada anterior if not item.contentType: if modo_serie_temp == 0: item.contentType = "season" else: item.contentType = "tvshow" if item.contentSeason: - item.contentSeason = 0 + del item.infoLabels['season'] elif max_temp < item.infoLabels["number_of_seasons"]: #Si tenemos en .nfo menos temporadas, Temp. item.contentType = "season" diff --git a/plugin.video.alfa/channels/hdfull.py b/plugin.video.alfa/channels/hdfull.py index 10982992..f02dff6f 100644 --- a/plugin.video.alfa/channels/hdfull.py +++ b/plugin.video.alfa/channels/hdfull.py @@ -413,9 +413,6 @@ def episodios(item): patron = "
  • [^<]+
  • " matches = re.compile(patron, re.DOTALL).findall(data) for scrapedurl in matches: - if "temporada-0" in scrapedurl: - continue - ## Episodios data = agrupa_datos(httptools.downloadpage(scrapedurl).data) sid = scrapertools.get_match(data, "") + unpacked = jsunpack.unpack(packed) video_urls = [] - videos = scrapertools.find_multiple_matches(data, 'file:"([^"]+).*?label:"([^"]+)') + videos = scrapertools.find_multiple_matches(unpacked, 'file:"([^"]+).*?label:"([^"]+)') for video, label in videos: video_urls.append([label + " [clipwatching]", video]) logger.info("Url: %s" %videos) diff --git a/plugin.video.alfa/servers/cloudvideo.json b/plugin.video.alfa/servers/cloudvideo.json new file mode 100644 index 00000000..bdb34dfb --- /dev/null +++ b/plugin.video.alfa/servers/cloudvideo.json @@ -0,0 +1,42 @@ +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "https://cloudvideo.tv/embed-([a-z0-9]+).html", + "url": "https://cloudvideo.tv/embed-\\1.html" + } + ] + }, + "free": true, + "id": "cloudvideo", + "name": "cloudvideo", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "Incluir en lista negra", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "Incluir en lista de favoritos", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ], + "thumbnail": "https://cloudvideo.tv/static/img/logo5.png" +} diff --git a/plugin.video.alfa/servers/cloudvideo.py b/plugin.video.alfa/servers/cloudvideo.py new file mode 100644 index 00000000..5ce34553 --- /dev/null +++ b/plugin.video.alfa/servers/cloudvideo.py @@ -0,0 +1,43 @@ +# Conector Cloudvideo By Alfa development Group +# -------------------------------------------------------- + +import re +from core import httptools +from core import scrapertools +from lib import jsunpack +from platformcode import logger + + +def test_video_exists(page_url): + logger.info("(page_url='%s')" % page_url) + + data = httptools.downloadpage(page_url) + + if data.code == 404: + return False, "[Cloud] El archivo no existe o ha sido borrado" + + return True, "" + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + logger.info("url=" + page_url) + + video_urls = [] + data = httptools.downloadpage(page_url).data + data = re.sub(r'"|\n|\r|\t| |
    |\s{2,}', "", data) + enc_data = scrapertools.find_single_match(data, "type='text/javascript'>(.*?)") + dec_data = jsunpack.unpack(enc_data) + sources = scrapertools.find_single_match(dec_data, "sources:\[(.*?)]") + patron = "{file:(.*?)}" + matches = re.compile(patron, re.DOTALL).findall(sources) + scrapertools.printMatches(matches) + for url in matches: + quality = 'm3u8' + video_url = url + if 'label' in url: + url = url.split(',') + video_url = url[0] + quality = url[1].replace('label:','') + video_urls.append(['cloudvideo [%s]' % quality, video_url]) + + return video_urls \ No newline at end of file diff --git a/plugin.video.alfa/servers/filevideo.json b/plugin.video.alfa/servers/filevideo.json new file mode 100644 index 00000000..9098f191 --- /dev/null +++ b/plugin.video.alfa/servers/filevideo.json @@ -0,0 +1,42 @@ +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "https://www.filevideo.net/embed-(?:embed-|)([A-z0-9]+)", + "url": "http://filevideo.net/embed-\\1.html" + } + ] + }, + "free": true, + "id": "filevideo", + "name": "filevideo", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "Incluir en lista negra", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "Incluir en lista de favoritos", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ], + "thumbnail": "https://s15.postimg.cc/b7jj9dbbf/filevideo.png" +} \ No newline at end of file diff --git a/plugin.video.alfa/servers/filevideo.py b/plugin.video.alfa/servers/filevideo.py new file mode 100644 index 00000000..c456b5ff --- /dev/null +++ b/plugin.video.alfa/servers/filevideo.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +from core import httptools +from core import scrapertools +from lib import jsunpack +from platformcode import logger + + +def test_video_exists(page_url): + logger.info("(page_url='%s')" % page_url) + + data = httptools.downloadpage(page_url).data + + if "Not Found" in data or "File was deleted" in data: + return False, "[Filevideo] El fichero no existe o ha sido borrado" + + return True, "" + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + logger.info("url=" + page_url) + + data = httptools.downloadpage(page_url).data + enc_data = scrapertools.find_single_match(data, "type='text/javascript'>(eval.*?)\s*") + dec_data = jsunpack.unpack(enc_data) + + video_urls = [] + media_urls = scrapertools.find_multiple_matches(dec_data, '\{file\s*:\s*"([^"]+)",label\s*:\s*"([^"]+)"\}') + for media_url, label in media_urls: + ext = scrapertools.get_filename_from_url(media_url)[-4:] + video_urls.append(["%s %sp [filevideo]" % (ext, label), media_url]) + + video_urls.reverse() + m3u8 = scrapertools.find_single_match(dec_data, '\{file\:"(.*?.m3u8)"\}') + if m3u8: + title = video_urls[-1][0].split(" ", 1)[1] + video_urls.insert(0, [".m3u8 %s" % title, m3u8]) + + for video_url in video_urls: + logger.info("%s - %s" % (video_url[0], video_url[1])) + + return video_urls diff --git a/plugin.video.alfa/servers/rapidvideo.py b/plugin.video.alfa/servers/rapidvideo.py index 57ff5c27..91832210 100755 --- a/plugin.video.alfa/servers/rapidvideo.py +++ b/plugin.video.alfa/servers/rapidvideo.py @@ -12,6 +12,8 @@ def test_video_exists(page_url): except: pass + if response.code == 404: + return False, "[Rapidvideo] El archivo no existe ó ha sido borrado" if not response.data or "urlopen error [Errno 1]" in str(response.code): from platformcode import config if config.is_xbmc(): diff --git a/plugin.video.alfa/servers/upvid.json b/plugin.video.alfa/servers/upvid.json new file mode 100644 index 00000000..058fae74 --- /dev/null +++ b/plugin.video.alfa/servers/upvid.json @@ -0,0 +1,42 @@ +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "https://upvid.co/embed-([a-z0-9]+).html", + "url": "https://upvid.co/embed-\\1.html" + } + ] + }, + "free": true, + "id": "upvid", + "name": "upvid", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "Incluir en lista negra", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "Incluir en lista de favoritos", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ], + "thumbnail": "https://s15.postimg.cc/gz0tee0gb/zt_Oi_E6_S-_400x400.jpg" +} diff --git a/plugin.video.alfa/servers/upvid.py b/plugin.video.alfa/servers/upvid.py new file mode 100644 index 00000000..c8686f81 --- /dev/null +++ b/plugin.video.alfa/servers/upvid.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +# -------------------------------------------------------- +# Conector UpVID By Alfa development Group +# -------------------------------------------------------- + +import re +import urllib +from core import httptools +from core import scrapertools +from platformcode import logger + +import sys, os +import re, base64 +from lib.aadecode import decode as aadecode + + +def test_video_exists(page_url): + logger.info("(page_url='%s')" % page_url) + + data = httptools.downloadpage(page_url) + + if data.code == 404: + return False, "[upvid] El archivo no existe o ha sido borrado" + + return True, "" + + +def get_video_url(page_url, premium = False, user = "", password = "", video_password = ""): + logger.info("url=" + page_url) + + video_urls = [] + headers = {'referer': page_url} + + for i in range(0, 3): + data = httptools.downloadpage(page_url, headers=headers).data + data = re.sub(r'"|\n|\r|\t| |
    |\s{2,}', "", data) + if '\s*゚ω゚(.*?)', data, flags=re.DOTALL)[0] + text_decode = aadecode(code) + funcion, clave = re.findall("func\.innerHTML = (\w*)\('([^']*)', ", text_decode, flags=re.DOTALL)[0] + + # decodificar javascript en campos html hidden + # -------------------------------------------- + oculto = re.findall('|\s{2,}', "", data) + logger.debug(data) + patron = "src=([^ ]+) type='.*?/(.*?)'" + matches = re.compile(patron, re.DOTALL).findall(data) + + for url, type in matches: + video_urls.append(['vidzella %s' % type, url]) + + return video_urls diff --git a/plugin.video.alfa/servers/vivo.json b/plugin.video.alfa/servers/vivo.json new file mode 100644 index 00000000..3b308512 --- /dev/null +++ b/plugin.video.alfa/servers/vivo.json @@ -0,0 +1,42 @@ +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "https://vivo.sx/([a-zA-Z0-9]+)", + "url": "https://vivo.sx/\\1" + } + ] + }, + "free": true, + "id": "vivo", + "name": "vivo", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "Incluir en lista negra", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "Incluir en lista de favoritos", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ], + "thumbnail": "https://s15.postimg.cc/oiyhtpdqj/vivo.png" +} \ No newline at end of file diff --git a/plugin.video.alfa/servers/vivo.py b/plugin.video.alfa/servers/vivo.py new file mode 100644 index 00000000..587926fb --- /dev/null +++ b/plugin.video.alfa/servers/vivo.py @@ -0,0 +1,39 @@ +# Conector Vivo By Alfa development Group +# -------------------------------------------------------- + +import re +import base64 +from core import httptools +from core import scrapertools +from platformcode import logger + + + +def test_video_exists(page_url): + logger.info("(page_url='%s')" % page_url) + + data = httptools.downloadpage(page_url) + + if data.code == 404: + return False, "[Vivo] El archivo no existe o ha sido borrado" + + return True, "" + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + logger.info("url=" + page_url) + + video_urls = [] + data = httptools.downloadpage(page_url).data + data = re.sub(r'"|\n|\r|\t| |
    |\s{2,}', "", data) + + enc_data = scrapertools.find_single_match(data, "Core.InitializeStream \('(.*?)'\)") + logger.debug(enc_data) + dec_data = base64.b64decode(enc_data) + + logger.debug(dec_data) + + for url in eval(dec_data): + video_urls.append(['vivo', url]) + + return video_urls diff --git a/plugin.video.alfa/servers/vshare.json b/plugin.video.alfa/servers/vshare.json index 8752af78..94a409eb 100644 --- a/plugin.video.alfa/servers/vshare.json +++ b/plugin.video.alfa/servers/vshare.json @@ -5,6 +5,10 @@ { "pattern": "(vshare.io/v/[a-zA-Z0-9/-]+)", "url": "http://\\1" + }, + { + "pattern": "(vshare.eu/embed-[a-zA-Z0-9/-]+.html)", + "url": "http://\\1" } ] }, diff --git a/plugin.video.alfa/servers/vshare.py b/plugin.video.alfa/servers/vshare.py index 23a8ddfe..bd3e76e3 100644 --- a/plugin.video.alfa/servers/vshare.py +++ b/plugin.video.alfa/servers/vshare.py @@ -26,22 +26,25 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= if flowplayer: return [["FLV", flowplayer.group(1)]] - jsUnpack = jsunpack.unpack(data) - logger.debug(jsUnpack) - video_urls = [] + try: + jsUnpack = jsunpack.unpack(data) + logger.debug(jsUnpack) + fields = re.search("\[([^\]]+).*?parseInt\(value\)-(\d+)", jsUnpack) + if fields: + logger.debug("Values: " + fields.group(1)) + logger.debug("Substract: " + fields.group(2)) + substract = int(fields.group(2)) - fields = re.search("\[([^\]]+).*?parseInt\(value\)-(\d+)", jsUnpack) - if fields: - logger.debug("Values: " + fields.group(1)) - logger.debug("Substract: " + fields.group(2)) - substract = int(fields.group(2)) + arrayResult = [chr(int(value) - substract) for value in fields.group(1).split(",")] + strResult = "".join(arrayResult) + logger.debug(strResult) + videoSources = re.findall("[^\"']+)[^>]+label=[\"'](?P