Mejoras internas

Mejoras en búsquedas
This commit is contained in:
Kingbox
2018-08-15 19:02:17 +02:00
parent 9918a96355
commit 03d528f71b
4 changed files with 50 additions and 12 deletions
+4 -2
View File
@@ -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 = 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.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 = 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 = '<div class="enlace_descarga".*?<a href="(.*?\.torrent)"' patron_t = '<div class="enlace_descarga".*?<a href="(.*?\.torrent)"'
link_torrent = scrapertools.find_single_match(data, patron_t) link_torrent = scrapertools.find_single_match(data, patron_t)
@@ -301,6 +299,10 @@ def findvideos(item):
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB #Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
if size:
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
#Generamos una copia de Item para trabajar sobre ella #Generamos una copia de Item para trabajar sobre ella
item_local = item.clone() item_local = item.clone()
@@ -460,10 +460,18 @@ def findvideos(item):
item_local.quality = quality + tiempo item_local.quality = quality + tiempo
if "temporada" in temp_epi.lower(): if "temporada" in temp_epi.lower():
item_local.quality = '%s [Temporada]' % item_local.quality item_local.quality = '%s [Temporada]' % item_local.quality
#Añadimos la duración, que estará en item.quility
if scrapertools.find_single_match(item.quality, '(\[\d+:\d+)'): #si ya tiene la duración, la ponemos
item_local.quality = '%s [%s h]' % (item_local.quality, scrapertools.find_single_match(item.quality, '(\d+:\d+)'))
#if size and item_local.contentType != "episode": #if size and item_local.contentType != "episode":
if size: if size:
size = size.replace(".", ",").replace("B,", " B").replace("b,", " b") size = size.replace(".", ",").replace("B,", " B").replace("b,", " b")
item_local.quality = '%s [%s]' % (item_local.quality, size) item_local.quality = '%s [%s]' % (item_local.quality, size)
if item_local.action == 'show_result': #Viene de una búsqueda global
channel = item_local.channel.capitalize()
if item_local.from_channel:
channel = item_local.from_channel.capitalize()
item_local.quality = '[COLOR yellow][%s][/COLOR] %s' % (channel, item_local.quality)
#Salvamos la url del .torrent #Salvamos la url del .torrent
if scrapedurl: if scrapedurl:
+8 -4
View File
@@ -605,8 +605,10 @@ def listado(item):
if item_local.contentType == "movie": if item_local.contentType == "movie":
year = scrapertools.find_single_match(scrapedurl, r'(\d{4})') year = scrapertools.find_single_match(scrapedurl, r'(\d{4})')
if year >= "1900" and year <= "2040" and year != "2020": if year >= "1900" and year <= "2040" and year != "2020":
title_subs += [year] item_local.infoLabels['year'] = year
item_local.infoLabels['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 #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 item_local.title_subs = title_subs
@@ -1074,8 +1076,10 @@ def listado_busqueda(item):
year = "" year = ""
year = str(year) year = str(year)
if year >= "1900" and year <= "2040" and year != "2020": if year >= "1900" and year <= "2040" and year != "2020":
title_subs += [year] item_local.infoLabels['year'] = year
item_local.infoLabels['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 #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 item_local.title_subs = title_subs
+30 -6
View File
@@ -297,13 +297,26 @@ def post_tmdb_listado(item, itemlist):
rating = '' rating = ''
except: except:
pass pass
# Si TMDB no ha encontrado el vídeo limpiamos el año # Si TMDB no ha encontrado el vídeo limpiamos el año
if item_local.infoLabels['year'] == "-": if item_local.infoLabels['year'] == "-":
item_local.infoLabels['year'] = '' item_local.infoLabels['year'] = ''
item_local.infoLabels['aired'] = '' 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 # 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})') 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 # 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. 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 #Creción de título general del vídeo a visualizar en Findvideos
itemlist = [] itemlist = []
@@ -965,8 +978,8 @@ def post_tmdb_findvideos(item, itemlist):
tiempo_final = tiempo_final / 60 #Lo transformo a minutos tiempo_final = tiempo_final / 60 #Lo transformo a minutos
horas = tiempo_final / 60 #Lo transformo a horas horas = tiempo_final / 60 #Lo transformo a horas
resto = tiempo_final - (horas * 60) #guardo el resto de minutos de la hora 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 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 item.quality += ' [COLOR white][%s:%s h]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor
except: except:
pass 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 #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 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) #agregamos la opción de Añadir a Videoteca para péliculas (no series)
if item.contentType == 'movie' and item.contentChannel != "videolibrary": 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 #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 #Cargamos en .json del canal para ver las listas de valores en settings
fail_over = channeltools.get_channel_json(channel_py) fail_over = channeltools.get_channel_json(channel_py)
for settings in fail_over['settings']: #Se recorren todos los settings 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 fail_over = settings['default'] #Carga lista de clones
break break
fail_over_list = ast.literal_eval(fail_over) 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 #Recorremos el Array identificando el canal que falla
for active, channel, channel_host, contentType, action_excluded in fail_over_list: for active, channel, channel_host, contentType, action_excluded in fail_over_list:
if item.channel == channel_py: if item.channel == channel_py:
@@ -1183,6 +1206,7 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None):
break break
if not channel_failed: if not channel_failed:
logger.error('Patrón: ' + str(patron) + ' / fail_over_list: ' + str(fail_over_list))
logger.error(item) logger.error(item)
return (item, data) #Algo no ha funcionado, no podemos hacer nada return (item, data) #Algo no ha funcionado, no podemos hacer nada