Newpct1: mejora en la disponibilidad

This commit is contained in:
Kingbox
2018-11-21 18:48:40 +01:00
parent 1c1901b038
commit fc04c143ec
3 changed files with 29 additions and 15 deletions
+14 -4
View File
@@ -133,8 +133,11 @@ def mainlist(item):
thumbnail=thumb_docus, category=item.category, channel_host=item.channel_host))
itemlist.append(
Item(channel=item.channel, action="search", title="Buscar", url=item.channel_host + "buscar", thumbnail=thumb_buscar, category=item.category, channel_host=item.channel_host))
itemlist.append(Item(channel=item.channel, url=host, title="[COLOR yellow]Configuración:[/COLOR]", folder=False, thumbnail=thumb_separador, category=item.category, channel_host=item.channel_host))
clone_act = 'Clone: '
if config.get_setting('clonenewpct1_channel_default', channel_py) == 0:
clone_act = 'Aleatorio: '
itemlist.append(Item(channel=item.channel, url=host, title="[COLOR yellow]Configuración:[/COLOR] (" + clone_act + item.category + ")", folder=False, thumbnail=thumb_separador, category=item.category, channel_host=item.channel_host))
itemlist.append(Item(channel=item.channel, action="settingCanal", title="Configurar canal", thumbnail=thumb_settings, category=item.category, channel_host=item.channel_host))
@@ -243,9 +246,8 @@ def submenu_novedades(item):
item.extra2 = ''
#Renombramos el canal al nombre de clone inicial desde la URL
host = scrapertools.find_single_match(item.url, '(http.?\:\/\/(?:www.)?\w+\.\w+\/)')
item.channel_host = host
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
item.category = channel_clone_name.capitalize()
data = ''
timeout_search=timeout * 2 #Más tiempo para Novedades, que es una búsqueda
@@ -2051,7 +2053,15 @@ def episodios(item):
if match['episode'] is None: match['episode'] = "0"
try:
match['season'] = int(match['season'])
season_alt = match['season']
match['episode'] = int(match['episode'])
if match['season'] > max_temp:
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))
match['season'] = scrapertools.find_single_match(item_local.url, '\/[t|T]emp\w+-*(\d+)\/')
if not match['season']:
match['season'] = season_alt
else:
match['season'] = int(match['season'])
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))
@@ -62,7 +62,6 @@ def list_movies(item, silent=False):
for canal_org in new_item.library_urls:
canal = generictools.verify_channel(canal_org)
logger.error(canal)
try:
channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal])
logger.debug('El canal %s parece correcto' % channel_verify)
@@ -286,8 +285,6 @@ def list_tvshows(item):
# logger.debug("item_tvshow:\n" + item_tvshow.tostring('\n'))
## verifica la existencia de los canales ##
logger.debug(item_tvshow)
if len(item_tvshow.library_urls) > 0:
itemlist.append(item_tvshow)
+15 -8
View File
@@ -863,6 +863,7 @@ def post_tmdb_episodios(item, itemlist):
#Componemos el título final, aunque con Unify usará infoLabels['episodio_titulo']
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
item_local.title = item_local.title.replace("[", "-").replace("]", "-")
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
@@ -871,7 +872,7 @@ def post_tmdb_episodios(item, itemlist):
item_local.title = item_local.title.replace(" []", "").strip()
item_local.title = re.sub(r'\s?\[COLOR \w+\]\[\[?-?\s?\]?\]\[\/COLOR\]', '', item_local.title).strip()
item_local.title = re.sub(r'\s?\[COLOR \w+\]-?\s?\[\/COLOR\]', '', item_local.title).strip()
item_local.title = item_local.title.replace("[", "-").replace("]", "-").replace(".", ",").replace("GB", "G B").replace("Gb", "G b").replace("gb", "g b").replace("MB", "M B").replace("Mb", "M b").replace("mb", "m b")
item_local.title = item_local.title.replace(".", ",").replace("GB", "G B").replace("Gb", "G b").replace("gb", "g b").replace("MB", "M B").replace("Mb", "M b").replace("mb", "m b")
#Si la información de num. total de episodios de TMDB no es correcta, tratamos de calcularla
if num_episodios < item_local.contentEpisodeNumber:
@@ -1161,7 +1162,8 @@ def post_tmdb_findvideos(item, itemlist):
if item.channel_alt:
title_gen = '[COLOR yellow]%s [/COLOR][ALT]: %s' % (item.category.capitalize(), title_gen)
elif (config.get_setting("quit_channel_name", "videolibrary") == 1 or item.channel == channel_py) and item.contentChannel == "videolibrary":
#elif (config.get_setting("quit_channel_name", "videolibrary") == 1 or item.channel == channel_py) and item.contentChannel == "videolibrary":
else:
title_gen = '%s: %s' % (item.category.capitalize(), title_gen)
#Si intervención judicial, alerto!!!
@@ -1814,6 +1816,9 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
if item.channel_host: #y se borran resto de pasadas anteriores
del item.channel_host
if it.emergency_urls:
item.emergency_urls = it.emergency_urls #Refrescar desde el .nfo
#Analizamos si hay series o películas que migrar, debido a que se ha activado en el .json del canal la opción "guardar"
#"emergency_urls = 1", y hay que calcularla para todos los episodios y película existentes en la Videoteca.
#Si "emergency_urls" está activada para uno o más canales, se verifica en el .nfo del vídeo si ya se ha realizado
@@ -1824,10 +1829,7 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
#automáticamente. En el caso de peliculas, se general aquí el json actualizado y se marca el .nfo como actualizado.
#Cuando en el .json se activa "Borrar", "emergency_urls = 2", se borran todos los enlaces existentes
#Cuando en el .json se activa "Actualizar", "emergency_urls = 3", se actualizan todos los enlaces existentes
if it.emergency_urls:
item.emergency_urls = it.emergency_urls #Refrescar desde el .nfo
"""
verify_cached_torrents() #TEMPORAL: verificamos si los .torrents son correctos
try: #Si ha habido errores, vemos la lista y los reparamos
json_error_path = filetools.join(config.get_runtime_path(), 'error_cached_torrents.json')
@@ -1875,7 +1877,12 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
if not encontrado:
logger.error('REGENERANDO: ' + str(item.emergency_urls))
item.emergency_urls.pop(channel_alt, None)
except:
logger.error('Error en el proceso de RECARGA de URLs de Emergencia')
logger.error(traceback.format_exc())
"""
try:
if item.url: #Viene de actualización de videoteca de series
#Analizamos si el canal ya tiene las urls de emergencia: guardar o borrar
if (config.get_setting("emergency_urls", item.channel) == 1 and (not item.emergency_urls or (item.emergency_urls and not item.emergency_urls.get(channel_alt, False)))) or (config.get_setting("emergency_urls", item.channel) == 2 and item.emergency_urls.get(channel_alt, False)) or config.get_setting("emergency_urls", item.channel) == 3 or emergency_urls_force:
@@ -1894,7 +1901,7 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
except:
logger.error('Error en el proceso de ALMACENAMIENTO de URLs de Emergencia')
logger.error(traceback.format_exc())
#Ahora tratamos las webs intervenidas, tranformamos la url, el nfo y borramos los archivos obsoletos de la serie
if channel not in intervencion and channel_py_alt not in intervencion and category not in intervencion and channel_alt != 'videolibrary': #lookup
return (item, it, overwrite) #... el canal/clone está listado