From 03d528f71bc3e72be26e473b8b76dfdf09bc8f85 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 15 Aug 2018 19:02:17 +0200 Subject: [PATCH] Mejoras internas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mejoras en búsquedas --- plugin.video.alfa/channels/elitetorrent.py | 6 ++-- plugin.video.alfa/channels/grantorrent.py | 8 +++++ plugin.video.alfa/channels/newpct1.py | 12 +++++--- plugin.video.alfa/lib/generictools.py | 36 ++++++++++++++++++---- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/plugin.video.alfa/channels/elitetorrent.py b/plugin.video.alfa/channels/elitetorrent.py index fccba66c..c4b74f07 100644 --- a/plugin.video.alfa/channels/elitetorrent.py +++ b/plugin.video.alfa/channels/elitetorrent.py @@ -274,8 +274,6 @@ def findvideos(item): 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 patron_t = '
= "1900" and year <= "2040" and year != "2020": - title_subs += [year] - item_local.infoLabels['year'] = '-' + item_local.infoLabels['year'] = year + #title_subs += [year] + else: + item_local.infoLabels['year'] = '-' #Guarda la variable temporal que almacena la info adicional del título a ser restaurada después de TMDB item_local.title_subs = title_subs @@ -1074,8 +1076,10 @@ def listado_busqueda(item): year = "" year = str(year) if year >= "1900" and year <= "2040" and year != "2020": - title_subs += [year] - item_local.infoLabels['year'] = '-' + item_local.infoLabels['year'] = year + #title_subs += [year] + else: + item_local.infoLabels['year'] = '-' #Guarda la variable temporal que almacena la info adicional del título a ser restaurada después de TMDB item_local.title_subs = title_subs diff --git a/plugin.video.alfa/lib/generictools.py b/plugin.video.alfa/lib/generictools.py index 8f1c130e..639d374d 100644 --- a/plugin.video.alfa/lib/generictools.py +++ b/plugin.video.alfa/lib/generictools.py @@ -297,13 +297,26 @@ def post_tmdb_listado(item, itemlist): rating = '' except: pass - + # 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'] = '' + + # Si TMDB no ha encontrado nada y hemos usado el año de la web, lo intentamos sin año + if not item_local.infoLabels['tmdb_id']: + if item_local.infoLabels['year']: #lo intentamos de nuevo solo si había año, puede que erroneo + year = item_local.infoLabels['year'] #salvamos el año por si no tiene éxito la nueva búsqueda + item_local.infoLabels['year'] = "-" #reseteo el año + try: + tmdb.set_infoLabels(item_local, True) #pasamos otra vez por TMDB + except: + pass + if not item_local.infoLabels['tmdb_id']: #ha tenido éxito? + item_local.infoLabels['year'] = year #no, restauramos el año y lo dejamos ya + # Para Episodios, tomo el año de exposición y no el de inicio de la serie - elif item_local.infoLabels['aired']: + if item_local.infoLabels['aired']: item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})') # Preparamos el título para series, con los núm. de temporadas, si las hay @@ -873,7 +886,7 @@ def post_tmdb_findvideos(item, itemlist): En Itemlist devuelve un Item con el pseudotítulo. Ahí el canal irá agregando el resto. """ - #logger.debug(item) + logger.debug(item) #Creción de título general del vídeo a visualizar en Findvideos itemlist = [] @@ -965,8 +978,8 @@ def post_tmdb_findvideos(item, itemlist): tiempo_final = tiempo_final / 60 #Lo transformo a minutos horas = tiempo_final / 60 #Lo transformo a horas resto = tiempo_final - (horas * 60) #guardo el resto de minutos de la hora - if not scrapertools.find_single_match(item.quality, '(\[\d+:\d+\])'): #si ya tiene la duración, pasamos - item.quality += ' [%s:%s]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor + if not scrapertools.find_single_match(item.quality, '(\[\d+:\d+)'): #si ya tiene la duración, pasamos + item.quality += ' [COLOR white][%s:%s h]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor except: pass @@ -1019,6 +1032,14 @@ def post_tmdb_findvideos(item, itemlist): #Pintamos el pseudo-título con toda la información disponible del vídeo itemlist.append(item.clone(action="", server = "", title=title_gen)) #Título con todos los datos del vídeo + if item.action == 'show_result': #Viene de una búsqueda global + channel = item.channel.capitalize() + if item.from_channel == channel_py or item.channel == channel_py: + channel = item.category + elif item.from_channel: + channel = item.from_channel.capitalize() + item.quality = '[COLOR yellow][%s][/COLOR] %s' % (channel, item.quality) + #agregamos la opción de Añadir a Videoteca para péliculas (no series) if item.contentType == 'movie' and item.contentChannel != "videolibrary": #Permitimos la actualización de los títulos, bien para uso inmediato, o para añadir a la videoteca @@ -1159,11 +1180,13 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None): #Cargamos en .json del canal para ver las listas de valores en settings fail_over = channeltools.get_channel_json(channel_py) for settings in fail_over['settings']: #Se recorren todos los settings - if settings['id'] == "clonenewpct1_channels_list": #Encontramos en setting + if settings['id'] == "clonenewpct1_channels_list": #Encontramos en setting fail_over = settings['default'] #Carga lista de clones break fail_over_list = ast.literal_eval(fail_over) + if item.from_channel: #Desde search puede venir con el nombre de canal equivocado + item.channel = item.from_channel #Recorremos el Array identificando el canal que falla for active, channel, channel_host, contentType, action_excluded in fail_over_list: if item.channel == channel_py: @@ -1183,6 +1206,7 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None): break if not channel_failed: + logger.error('Patrón: ' + str(patron) + ' / fail_over_list: ' + str(fail_over_list)) logger.error(item) return (item, data) #Algo no ha funcionado, no podemos hacer nada