diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index 44d5024d..fe136a21 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -1,5 +1,5 @@ - + @@ -19,12 +19,14 @@ [B]Estos son los cambios para esta versión:[/B] [COLOR green][B]Canales agregados y arreglos[/B][/COLOR] - » cinecalidad » animemovil - » seriesverde » animejl - » pelisipad » gmobi - » inkapelis » pelisgratis - » pelispedia » animeyt - » qserie + » grantorrent » descargas2020 + » torrentlocura » torrentrapid + » tumejortorrent » tvsinpagar + » mispelisyseries » kbagi + » animemovil » pelismagnet + » pelisultra » seriesdanko + » seriespapaya » seriesverde + » ultrapeliculas » wikiseries ¤ arreglos internos diff --git a/plugin.video.alfa/channels/animemovil.py b/plugin.video.alfa/channels/animemovil.py index 5c4031fc..0cd3153a 100644 --- a/plugin.video.alfa/channels/animemovil.py +++ b/plugin.video.alfa/channels/animemovil.py @@ -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) diff --git a/plugin.video.alfa/channels/autoplay.py b/plugin.video.alfa/channels/autoplay.py index 3a6f5684..bb7fefd8 100644 --- a/plugin.video.alfa/channels/autoplay.py +++ b/plugin.video.alfa/channels/autoplay.py @@ -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 diff --git a/plugin.video.alfa/channels/descargas2020.py b/plugin.video.alfa/channels/descargas2020.py index 23d388b9..01aed6bb 100644 --- a/plugin.video.alfa/channels/descargas2020.py +++ b/plugin.video.alfa/channels/descargas2020.py @@ -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, '
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\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}\]'): 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\d+).*?Cap\w?\.\s\d?(?P\d{2})(?:.*?(?P\d{2}))?.*?\[(?P.*?)\].*?\[(?P\w+)\]?' if scrapertools.find_single_match(info, '\[Cap.\d{2,3}'): pattern = "\[(?P.*?)\].*?\[Cap.(?P\d).*?(?P\d{2})(?:_(?P\d+)" \ "(?P\d{2}))?.*?\].*?(?:\[(?P.*?)\])?" @@ -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) diff --git a/plugin.video.alfa/channels/grantorrent.py b/plugin.video.alfa/channels/grantorrent.py index 6ecb1fab..f2534bd9 100644 --- a/plugin.video.alfa/channels/grantorrent.py +++ b/plugin.video.alfa/channels/grantorrent.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 = "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 = '