From 665fc8b098bef964b65b23b1221c2a27775c9935 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Sat, 9 Jun 2018 20:18:38 +0200 Subject: [PATCH] GranTorrent y Clones de NewPct1: mejoras MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mejoras internas en gestión de episodios especiales --- plugin.video.alfa/channels/descargas2020.py | 84 ++++++++++++++----- plugin.video.alfa/channels/grantorrent.py | 38 ++++++--- plugin.video.alfa/channels/mispelisyseries.py | 84 ++++++++++++++----- plugin.video.alfa/channels/torrentlocura.py | 84 ++++++++++++++----- plugin.video.alfa/channels/torrentrapid.py | 84 ++++++++++++++----- plugin.video.alfa/channels/tumejortorrent.py | 84 ++++++++++++++----- plugin.video.alfa/channels/tvsinpagar.py | 84 ++++++++++++++----- 7 files changed, 406 insertions(+), 136 deletions(-) diff --git a/plugin.video.alfa/channels/descargas2020.py b/plugin.video.alfa/channels/descargas2020.py index 19d1e88b..23d388b9 100644 --- a/plugin.video.alfa/channels/descargas2020.py +++ b/plugin.video.alfa/channels/descargas2020.py @@ -66,7 +66,7 @@ def submenu(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -156,7 +156,7 @@ def listado(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -302,6 +302,7 @@ def listado(item): #Extraemos info adicional del título y la guardamos para después de TMDB if "temp" in title.lower() or "cap" in title.lower(): #Eliminamos Temporada, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+x\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -508,12 +509,12 @@ def listado_busqueda(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, post=item.post).data) except: - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos cnt_next += 1 if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -592,6 +593,7 @@ def listado_busqueda(item): #logger.debug("PATRON: " + pattern) #logger.debug(matches) + #logger.debug(title_lista_alt) #logger.debug(data) cnt_title = 0 @@ -691,6 +693,7 @@ def listado_busqueda(item): #Extraemos info adicional del título y la guardamos para después de TMDB if ("temp" in title.lower() or "cap" in title.lower()) and item_local.contentType != "movie": #Eliminamos Temporada de Series, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+[x|X]\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -936,8 +939,6 @@ def findvideos(item): logger.info() itemlist = [] - logger.debug(item) - # Cualquiera de las tres opciones son válidas # item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/descarga-directa/") @@ -1071,7 +1072,7 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -1349,7 +1350,7 @@ def episodios(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) except: #Algún error de proceso, salimos - logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea") + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist @@ -1375,6 +1376,11 @@ def episodios(item): else: list_pages = [item.url] + season = max_temp + if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas + num_temporadas_flag = True + else: + num_temporadas_flag = False for page in list_pages: #Recorre la lista de páginas if not list_pages: break @@ -1388,7 +1394,7 @@ def episodios(item): if not data: raise except: - logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages + " / DATA: " + data)) + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -1401,13 +1407,11 @@ def episodios(item): logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - data = '' #logger.debug("patron: " + pattern) #logger.debug(matches) #Empezamos a generar cada episodio - season = max_temp for url, thumb, info in matches: if "pelisyseries.com" in host: #En esta web están en diferente orden interm = url @@ -1465,6 +1469,23 @@ def episodios(item): if match['season'] is None: match['season'] = season #Si no se encuentran valores, pero poner lo básico if match['episode'] is None: match['episode'] = "0" + try: + match['season'] = int(match['season']) + match['episode'] = int(match['episode']) + 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)) + + 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)) + match['season'] = season + item_local.contentSeason = season + else: + item_local.contentSeason = match['season'] + season = match['season'] + num_temporadas_flag = True + if season > max_temp: + max_temp = season if match['quality'] and not item_local.quality and estado == True: item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie @@ -1481,7 +1502,6 @@ def episodios(item): item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2)) item_local.contentEpisodeNumber = match['episode'] - item_local.contentSeason = match['season'] if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca if item_local.contentSeason < max_temp: @@ -1512,16 +1532,21 @@ def episodios(item): del item_local.update_next itemlist.append(item_local.clone()) + + data = '' + + if len(itemlist) > 1: + itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos # Pasada por TMDB y clasificación de lista por temporada y episodio - tmdb.set_infoLabels(itemlist, seekTmdb = True) - if len(itemlist) > 1: - itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) + tmdb.set_infoLabels(itemlist, True) # Pasada para maqullaje de los títulos obtenidos desde TMDB num_episodios = 1 - num_episodios_lista = [0] + 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: @@ -1535,6 +1560,19 @@ def episodios(item): 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 @@ -1569,13 +1607,17 @@ def episodios(item): 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] + 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)) - - 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] + #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 = '' diff --git a/plugin.video.alfa/channels/grantorrent.py b/plugin.video.alfa/channels/grantorrent.py index bde52446..6ecb1fab 100644 --- a/plugin.video.alfa/channels/grantorrent.py +++ b/plugin.video.alfa/channels/grantorrent.py @@ -65,7 +65,7 @@ def submenu(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #Algo no funciona, pintamos lo que tenemos @@ -127,12 +127,12 @@ def listado(item): data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.post).data) video_section = scrapertools.find_single_match(data, '
(.*?
)') except: - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + video_section) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + video_section) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos cnt_next += 1 if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + video_section) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + video_section) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -421,7 +421,7 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "utf-8", errors="replace").encode("utf-8") @@ -824,7 +824,7 @@ def episodios(item): item_local.contentEpisodeNumber = 0 item_local.contentEpisodeNumber = int(item_local.contentEpisodeNumber) except: - logger.error("ERROR 07: EPISODIOS: Error en número de Episodio: " + temp_epi) + logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + temp_epi) continue #si da un error pasamos del episodio if item_local.contentSeason != temp_actual_num: #A veces es diferente el num de Temp. de la URL y de @@ -872,8 +872,10 @@ def episodios(item): # Pasada para maquillaje de los títulos obtenidos desde TMDB num_episodios = 1 - num_episodios_lista = [0] + 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: @@ -887,6 +889,19 @@ def episodios(item): 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 @@ -925,14 +940,17 @@ def episodios(item): 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] + 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) - 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] + 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 = '' diff --git a/plugin.video.alfa/channels/mispelisyseries.py b/plugin.video.alfa/channels/mispelisyseries.py index d886efe9..36f632c8 100644 --- a/plugin.video.alfa/channels/mispelisyseries.py +++ b/plugin.video.alfa/channels/mispelisyseries.py @@ -66,7 +66,7 @@ def submenu(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -156,7 +156,7 @@ def listado(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -302,6 +302,7 @@ def listado(item): #Extraemos info adicional del título y la guardamos para después de TMDB if "temp" in title.lower() or "cap" in title.lower(): #Eliminamos Temporada, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+x\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -508,12 +509,12 @@ def listado_busqueda(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, post=item.post).data) except: - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos cnt_next += 1 if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -592,6 +593,7 @@ def listado_busqueda(item): #logger.debug("PATRON: " + pattern) #logger.debug(matches) + #logger.debug(title_lista_alt) #logger.debug(data) cnt_title = 0 @@ -691,6 +693,7 @@ def listado_busqueda(item): #Extraemos info adicional del título y la guardamos para después de TMDB if ("temp" in title.lower() or "cap" in title.lower()) and item_local.contentType != "movie": #Eliminamos Temporada de Series, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+[x|X]\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -936,8 +939,6 @@ def findvideos(item): logger.info() itemlist = [] - logger.debug(item) - # Cualquiera de las tres opciones son válidas # item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/descarga-directa/") @@ -1071,7 +1072,7 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -1349,7 +1350,7 @@ def episodios(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) except: #Algún error de proceso, salimos - logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea") + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist @@ -1375,6 +1376,11 @@ def episodios(item): else: list_pages = [item.url] + season = max_temp + if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas + num_temporadas_flag = True + else: + num_temporadas_flag = False for page in list_pages: #Recorre la lista de páginas if not list_pages: break @@ -1388,7 +1394,7 @@ def episodios(item): if not data: raise except: - logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages + " / DATA: " + data)) + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -1401,13 +1407,11 @@ def episodios(item): logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - data = '' #logger.debug("patron: " + pattern) #logger.debug(matches) #Empezamos a generar cada episodio - season = max_temp for url, thumb, info in matches: if "pelisyseries.com" in host: #En esta web están en diferente orden interm = url @@ -1465,6 +1469,23 @@ def episodios(item): if match['season'] is None: match['season'] = season #Si no se encuentran valores, pero poner lo básico if match['episode'] is None: match['episode'] = "0" + try: + match['season'] = int(match['season']) + match['episode'] = int(match['episode']) + 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)) + + 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)) + match['season'] = season + item_local.contentSeason = season + else: + item_local.contentSeason = match['season'] + season = match['season'] + num_temporadas_flag = True + if season > max_temp: + max_temp = season if match['quality'] and not item_local.quality and estado == True: item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie @@ -1481,7 +1502,6 @@ def episodios(item): item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2)) item_local.contentEpisodeNumber = match['episode'] - item_local.contentSeason = match['season'] if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca if item_local.contentSeason < max_temp: @@ -1512,16 +1532,21 @@ def episodios(item): del item_local.update_next itemlist.append(item_local.clone()) + + data = '' + + if len(itemlist) > 1: + itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos # Pasada por TMDB y clasificación de lista por temporada y episodio - tmdb.set_infoLabels(itemlist, seekTmdb = True) - if len(itemlist) > 1: - itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) + tmdb.set_infoLabels(itemlist, True) # Pasada para maqullaje de los títulos obtenidos desde TMDB num_episodios = 1 - num_episodios_lista = [0] + 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: @@ -1535,6 +1560,19 @@ def episodios(item): 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 @@ -1569,13 +1607,17 @@ def episodios(item): 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] + 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)) - - 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] + #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 = '' diff --git a/plugin.video.alfa/channels/torrentlocura.py b/plugin.video.alfa/channels/torrentlocura.py index 94e1c998..df56aece 100755 --- a/plugin.video.alfa/channels/torrentlocura.py +++ b/plugin.video.alfa/channels/torrentlocura.py @@ -66,7 +66,7 @@ def submenu(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -156,7 +156,7 @@ def listado(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -302,6 +302,7 @@ def listado(item): #Extraemos info adicional del título y la guardamos para después de TMDB if "temp" in title.lower() or "cap" in title.lower(): #Eliminamos Temporada, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+x\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -508,12 +509,12 @@ def listado_busqueda(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, post=item.post).data) except: - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos cnt_next += 1 if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -592,6 +593,7 @@ def listado_busqueda(item): #logger.debug("PATRON: " + pattern) #logger.debug(matches) + #logger.debug(title_lista_alt) #logger.debug(data) cnt_title = 0 @@ -691,6 +693,7 @@ def listado_busqueda(item): #Extraemos info adicional del título y la guardamos para después de TMDB if ("temp" in title.lower() or "cap" in title.lower()) and item_local.contentType != "movie": #Eliminamos Temporada de Series, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+[x|X]\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -936,8 +939,6 @@ def findvideos(item): logger.info() itemlist = [] - logger.debug(item) - # Cualquiera de las tres opciones son válidas # item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/descarga-directa/") @@ -1071,7 +1072,7 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -1349,7 +1350,7 @@ def episodios(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) except: #Algún error de proceso, salimos - logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea") + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist @@ -1375,6 +1376,11 @@ def episodios(item): else: list_pages = [item.url] + season = max_temp + if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas + num_temporadas_flag = True + else: + num_temporadas_flag = False for page in list_pages: #Recorre la lista de páginas if not list_pages: break @@ -1388,7 +1394,7 @@ def episodios(item): if not data: raise except: - logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages + " / DATA: " + data)) + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -1401,13 +1407,11 @@ def episodios(item): logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - data = '' #logger.debug("patron: " + pattern) #logger.debug(matches) #Empezamos a generar cada episodio - season = max_temp for url, thumb, info in matches: if "pelisyseries.com" in host: #En esta web están en diferente orden interm = url @@ -1465,6 +1469,23 @@ def episodios(item): if match['season'] is None: match['season'] = season #Si no se encuentran valores, pero poner lo básico if match['episode'] is None: match['episode'] = "0" + try: + match['season'] = int(match['season']) + match['episode'] = int(match['episode']) + 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)) + + 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)) + match['season'] = season + item_local.contentSeason = season + else: + item_local.contentSeason = match['season'] + season = match['season'] + num_temporadas_flag = True + if season > max_temp: + max_temp = season if match['quality'] and not item_local.quality and estado == True: item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie @@ -1481,7 +1502,6 @@ def episodios(item): item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2)) item_local.contentEpisodeNumber = match['episode'] - item_local.contentSeason = match['season'] if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca if item_local.contentSeason < max_temp: @@ -1512,16 +1532,21 @@ def episodios(item): del item_local.update_next itemlist.append(item_local.clone()) + + data = '' + + if len(itemlist) > 1: + itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos # Pasada por TMDB y clasificación de lista por temporada y episodio - tmdb.set_infoLabels(itemlist, seekTmdb = True) - if len(itemlist) > 1: - itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) + tmdb.set_infoLabels(itemlist, True) # Pasada para maqullaje de los títulos obtenidos desde TMDB num_episodios = 1 - num_episodios_lista = [0] + 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: @@ -1535,6 +1560,19 @@ def episodios(item): 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 @@ -1569,13 +1607,17 @@ def episodios(item): 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] + 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)) - - 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] + #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 = '' diff --git a/plugin.video.alfa/channels/torrentrapid.py b/plugin.video.alfa/channels/torrentrapid.py index dca87382..06983789 100644 --- a/plugin.video.alfa/channels/torrentrapid.py +++ b/plugin.video.alfa/channels/torrentrapid.py @@ -66,7 +66,7 @@ def submenu(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -156,7 +156,7 @@ def listado(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -302,6 +302,7 @@ def listado(item): #Extraemos info adicional del título y la guardamos para después de TMDB if "temp" in title.lower() or "cap" in title.lower(): #Eliminamos Temporada, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+x\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -508,12 +509,12 @@ def listado_busqueda(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, post=item.post).data) except: - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos cnt_next += 1 if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -592,6 +593,7 @@ def listado_busqueda(item): #logger.debug("PATRON: " + pattern) #logger.debug(matches) + #logger.debug(title_lista_alt) #logger.debug(data) cnt_title = 0 @@ -691,6 +693,7 @@ def listado_busqueda(item): #Extraemos info adicional del título y la guardamos para después de TMDB if ("temp" in title.lower() or "cap" in title.lower()) and item_local.contentType != "movie": #Eliminamos Temporada de Series, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+[x|X]\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -936,8 +939,6 @@ def findvideos(item): logger.info() itemlist = [] - logger.debug(item) - # Cualquiera de las tres opciones son válidas # item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/descarga-directa/") @@ -1071,7 +1072,7 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -1349,7 +1350,7 @@ def episodios(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) except: #Algún error de proceso, salimos - logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea") + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist @@ -1375,6 +1376,11 @@ def episodios(item): else: list_pages = [item.url] + season = max_temp + if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas + num_temporadas_flag = True + else: + num_temporadas_flag = False for page in list_pages: #Recorre la lista de páginas if not list_pages: break @@ -1388,7 +1394,7 @@ def episodios(item): if not data: raise except: - logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages + " / DATA: " + data)) + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -1401,13 +1407,11 @@ def episodios(item): logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - data = '' #logger.debug("patron: " + pattern) #logger.debug(matches) #Empezamos a generar cada episodio - season = max_temp for url, thumb, info in matches: if "pelisyseries.com" in host: #En esta web están en diferente orden interm = url @@ -1465,6 +1469,23 @@ def episodios(item): if match['season'] is None: match['season'] = season #Si no se encuentran valores, pero poner lo básico if match['episode'] is None: match['episode'] = "0" + try: + match['season'] = int(match['season']) + match['episode'] = int(match['episode']) + 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)) + + 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)) + match['season'] = season + item_local.contentSeason = season + else: + item_local.contentSeason = match['season'] + season = match['season'] + num_temporadas_flag = True + if season > max_temp: + max_temp = season if match['quality'] and not item_local.quality and estado == True: item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie @@ -1481,7 +1502,6 @@ def episodios(item): item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2)) item_local.contentEpisodeNumber = match['episode'] - item_local.contentSeason = match['season'] if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca if item_local.contentSeason < max_temp: @@ -1512,16 +1532,21 @@ def episodios(item): del item_local.update_next itemlist.append(item_local.clone()) + + data = '' + + if len(itemlist) > 1: + itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos # Pasada por TMDB y clasificación de lista por temporada y episodio - tmdb.set_infoLabels(itemlist, seekTmdb = True) - if len(itemlist) > 1: - itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) + tmdb.set_infoLabels(itemlist, True) # Pasada para maqullaje de los títulos obtenidos desde TMDB num_episodios = 1 - num_episodios_lista = [0] + 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: @@ -1535,6 +1560,19 @@ def episodios(item): 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 @@ -1569,13 +1607,17 @@ def episodios(item): 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] + 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)) - - 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] + #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 = '' diff --git a/plugin.video.alfa/channels/tumejortorrent.py b/plugin.video.alfa/channels/tumejortorrent.py index 00950acc..646a0bfb 100644 --- a/plugin.video.alfa/channels/tumejortorrent.py +++ b/plugin.video.alfa/channels/tumejortorrent.py @@ -66,7 +66,7 @@ def submenu(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -156,7 +156,7 @@ def listado(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -302,6 +302,7 @@ def listado(item): #Extraemos info adicional del título y la guardamos para después de TMDB if "temp" in title.lower() or "cap" in title.lower(): #Eliminamos Temporada, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+x\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -508,12 +509,12 @@ def listado_busqueda(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, post=item.post).data) except: - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos cnt_next += 1 if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -592,6 +593,7 @@ def listado_busqueda(item): #logger.debug("PATRON: " + pattern) #logger.debug(matches) + #logger.debug(title_lista_alt) #logger.debug(data) cnt_title = 0 @@ -691,6 +693,7 @@ def listado_busqueda(item): #Extraemos info adicional del título y la guardamos para después de TMDB if ("temp" in title.lower() or "cap" in title.lower()) and item_local.contentType != "movie": #Eliminamos Temporada de Series, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+[x|X]\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -936,8 +939,6 @@ def findvideos(item): logger.info() itemlist = [] - logger.debug(item) - # Cualquiera de las tres opciones son válidas # item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/descarga-directa/") @@ -1071,7 +1072,7 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -1349,7 +1350,7 @@ def episodios(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) except: #Algún error de proceso, salimos - logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea") + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist @@ -1375,6 +1376,11 @@ def episodios(item): else: list_pages = [item.url] + season = max_temp + if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas + num_temporadas_flag = True + else: + num_temporadas_flag = False for page in list_pages: #Recorre la lista de páginas if not list_pages: break @@ -1388,7 +1394,7 @@ def episodios(item): if not data: raise except: - logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages + " / DATA: " + data)) + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -1401,13 +1407,11 @@ def episodios(item): logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - data = '' #logger.debug("patron: " + pattern) #logger.debug(matches) #Empezamos a generar cada episodio - season = max_temp for url, thumb, info in matches: if "pelisyseries.com" in host: #En esta web están en diferente orden interm = url @@ -1465,6 +1469,23 @@ def episodios(item): if match['season'] is None: match['season'] = season #Si no se encuentran valores, pero poner lo básico if match['episode'] is None: match['episode'] = "0" + try: + match['season'] = int(match['season']) + match['episode'] = int(match['episode']) + 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)) + + 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)) + match['season'] = season + item_local.contentSeason = season + else: + item_local.contentSeason = match['season'] + season = match['season'] + num_temporadas_flag = True + if season > max_temp: + max_temp = season if match['quality'] and not item_local.quality and estado == True: item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie @@ -1481,7 +1502,6 @@ def episodios(item): item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2)) item_local.contentEpisodeNumber = match['episode'] - item_local.contentSeason = match['season'] if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca if item_local.contentSeason < max_temp: @@ -1512,16 +1532,21 @@ def episodios(item): del item_local.update_next itemlist.append(item_local.clone()) + + data = '' + + if len(itemlist) > 1: + itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos # Pasada por TMDB y clasificación de lista por temporada y episodio - tmdb.set_infoLabels(itemlist, seekTmdb = True) - if len(itemlist) > 1: - itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) + tmdb.set_infoLabels(itemlist, True) # Pasada para maqullaje de los títulos obtenidos desde TMDB num_episodios = 1 - num_episodios_lista = [0] + 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: @@ -1535,6 +1560,19 @@ def episodios(item): 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 @@ -1569,13 +1607,17 @@ def episodios(item): 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] + 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)) - - 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] + #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 = '' diff --git a/plugin.video.alfa/channels/tvsinpagar.py b/plugin.video.alfa/channels/tvsinpagar.py index e7c13293..6c7f371c 100644 --- a/plugin.video.alfa/channels/tvsinpagar.py +++ b/plugin.video.alfa/channels/tvsinpagar.py @@ -66,7 +66,7 @@ def submenu(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -156,7 +156,7 @@ def listado(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -302,6 +302,7 @@ def listado(item): #Extraemos info adicional del título y la guardamos para después de TMDB if "temp" in title.lower() or "cap" in title.lower(): #Eliminamos Temporada, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+x\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -508,12 +509,12 @@ def listado_busqueda(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, post=item.post).data) except: - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos cnt_next += 1 if not data: #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL " + " / DATA: " + data) + logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO_BUSQUEDA:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -592,6 +593,7 @@ def listado_busqueda(item): #logger.debug("PATRON: " + pattern) #logger.debug(matches) + #logger.debug(title_lista_alt) #logger.debug(data) cnt_title = 0 @@ -691,6 +693,7 @@ def listado_busqueda(item): #Extraemos info adicional del título y la guardamos para después de TMDB if ("temp" in title.lower() or "cap" in title.lower()) and item_local.contentType != "movie": #Eliminamos Temporada de Series, solo nos interesa la serie completa + title = re.sub(r' - [t|T]emp\w+ \d+ Comp\w+\d+[x|X]\d+', ' Completa', title) title = re.sub(r' - [t|T]emp\w+ \d+[x|X]\d+', '', title) title = re.sub(r' - [t|T]emp\w+ \d+', '', title) title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) @@ -936,8 +939,6 @@ def findvideos(item): logger.info() itemlist = [] - logger.debug(item) - # Cualquiera de las tres opciones son válidas # item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/descarga-directa/") @@ -1071,7 +1072,7 @@ def findvideos(item): try: data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) except: - logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") @@ -1349,7 +1350,7 @@ def episodios(item): try: data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) except: #Algún error de proceso, salimos - logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea") + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) return itemlist @@ -1375,6 +1376,11 @@ def episodios(item): else: list_pages = [item.url] + season = max_temp + if item.library_playcounts: #Comprobamos si realmente sabemos el num. máximo de temporadas + num_temporadas_flag = True + else: + num_temporadas_flag = False for page in list_pages: #Recorre la lista de páginas if not list_pages: break @@ -1388,7 +1394,7 @@ def episodios(item): if not data: raise except: - logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages + " / DATA: " + data)) + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages) + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos @@ -1401,13 +1407,11 @@ def episodios(item): logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - data = '' #logger.debug("patron: " + pattern) #logger.debug(matches) #Empezamos a generar cada episodio - season = max_temp for url, thumb, info in matches: if "pelisyseries.com" in host: #En esta web están en diferente orden interm = url @@ -1465,6 +1469,23 @@ def episodios(item): if match['season'] is None: match['season'] = season #Si no se encuentran valores, pero poner lo básico if match['episode'] is None: match['episode'] = "0" + try: + match['season'] = int(match['season']) + match['episode'] = int(match['episode']) + 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)) + + 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)) + match['season'] = season + item_local.contentSeason = season + else: + item_local.contentSeason = match['season'] + season = match['season'] + num_temporadas_flag = True + if season > max_temp: + max_temp = season if match['quality'] and not item_local.quality and estado == True: item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie @@ -1481,7 +1502,6 @@ def episodios(item): item_local.title = "%sx%s -" % (match["season"], str(match["episode"]).zfill(2)) item_local.contentEpisodeNumber = match['episode'] - item_local.contentSeason = match['season'] if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca if item_local.contentSeason < max_temp: @@ -1512,16 +1532,21 @@ def episodios(item): del item_local.update_next itemlist.append(item_local.clone()) + + data = '' + + if len(itemlist) > 1: + itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos # Pasada por TMDB y clasificación de lista por temporada y episodio - tmdb.set_infoLabels(itemlist, seekTmdb = True) - if len(itemlist) > 1: - itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) + tmdb.set_infoLabels(itemlist, True) # Pasada para maqullaje de los títulos obtenidos desde TMDB num_episodios = 1 - num_episodios_lista = [0] + 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: @@ -1535,6 +1560,19 @@ def episodios(item): 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 @@ -1569,13 +1607,17 @@ def episodios(item): 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] + 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)) - - 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] + #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 = ''