Merge pull request #397 from lopezvg/master

Videolibrary.list_tvshows: errores aleatorios
This commit is contained in:
Alfa
2018-08-15 10:28:33 -05:00
committed by GitHub
2 changed files with 26 additions and 19 deletions
+9 -7
View File
@@ -53,8 +53,8 @@ def mainlist(item):
itemlist = [] itemlist = []
itemlist.append(Item(channel=item.channel, action="videos", title="Útimos videos", url=url_api + "/index/main/0/pc", itemlist.append(Item(channel=item.channel, action="videos", title="Útimos videos", url=url_api + "/index/main/0/pc",
viewmode="movie")) viewmode="movie"))
itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias Populares", #itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias Populares",
url=url_api + "/index/main/0/pc", extra="popular")) # url=url_api + "/index/main/0/pc", extra="popular"))
itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias completo", itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias completo",
url=url_api + "/index/main/0/pc", extra="nonpopular")) url=url_api + "/index/main/0/pc", extra="nonpopular"))
itemlist.append( itemlist.append(
@@ -74,7 +74,7 @@ def videos(item):
title = Video["title"] title = Video["title"]
itemlist.append( itemlist.append(
Item(channel=item.channel, action="play", title=title, url=url, thumbnail=thumbnail, plot="", show="", Item(channel=item.channel, action="play", title=title, url=url, thumbnail=thumbnail, plot="", show="",
folder=True)) folder=True, contentType="movie"))
# Paginador # Paginador
Actual = int(scrapertools.get_match(item.url, url_api + '/index/[^/]+/([0-9]+)/pc')) Actual = int(scrapertools.get_match(item.url, url_api + '/index/[^/]+/([0-9]+)/pc'))
@@ -93,10 +93,11 @@ def listcategorias(item):
data = scrapertools.cache_page(item.url) data = scrapertools.cache_page(item.url)
JSONData = json.load(data) JSONData = json.load(data)
for Tag in JSONData["tags"][item.extra]: #for Tag in JSONData["tags"][item.extra]:
url = url_api + "/index/tag/0/pc?tag=" + Tag for Tag in JSONData["tags"]:
title = Tag url = url_api + "/index/tag/0/pc?tag=" + Tag["tag"]
title = title[:1].upper() + title[1:] title = '%s - %s' % (str(Tag["tag"]), str(Tag["videos"]))
#title = title[:1].upper() + title[1:]
itemlist.append( itemlist.append(
Item(channel=item.channel, action="videos", title=title, url=url, folder=True, viewmode="movie")) Item(channel=item.channel, action="videos", title=title, url=url, folder=True, viewmode="movie"))
@@ -108,6 +109,7 @@ def search(item, texto):
texto = texto.replace(" ", "+") texto = texto.replace(" ", "+")
item.url = item.url % (texto) item.url = item.url % (texto)
try: try:
return videos(item) return videos(item)
# Se captura la excepción, para no interrumpir al buscador global si un canal falla # Se captura la excepción, para no interrumpir al buscador global si un canal falla
+17 -12
View File
@@ -127,19 +127,24 @@ def list_tvshows(item):
pass pass
head_nfo, item_tvshow = videolibrarytools.read_nfo(tvshow_path) head_nfo, item_tvshow = videolibrarytools.read_nfo(tvshow_path)
item_tvshow.title = item_tvshow.contentTitle try: #A veces da errores aleatorios, por no encontrar el .nfo. Probablemente problemas de timing
item_tvshow.path = raiz item_tvshow.title = item_tvshow.contentTitle
item_tvshow.nfo = tvshow_path item_tvshow.path = raiz
item_tvshow.nfo = tvshow_path
# Menu contextual: Marcar como visto/no visto # Menu contextual: Marcar como visto/no visto
visto = item_tvshow.library_playcounts.get(item_tvshow.contentTitle, 0) visto = item_tvshow.library_playcounts.get(item_tvshow.contentTitle, 0)
item_tvshow.infoLabels["playcount"] = visto item_tvshow.infoLabels["playcount"] = visto
if visto > 0: if visto > 0:
texto_visto = config.get_localized_string(60020) texto_visto = config.get_localized_string(60020)
contador = 0 contador = 0
else: else:
texto_visto = config.get_localized_string(60021) texto_visto = config.get_localized_string(60021)
contador = 1 contador = 1
except:
logger.error('No encuentra: ' + str(tvshow_path))
continue
# Menu contextual: Buscar automáticamente nuevos episodios o no # Menu contextual: Buscar automáticamente nuevos episodios o no
if item_tvshow.active and int(item_tvshow.active) > 0: if item_tvshow.active and int(item_tvshow.active) > 0: