diff --git a/plugin.video.alfa/channels/mejortorrent.py b/plugin.video.alfa/channels/mejortorrent.py index 517e6f0f..424c122c 100755 --- a/plugin.video.alfa/channels/mejortorrent.py +++ b/plugin.video.alfa/channels/mejortorrent.py @@ -105,7 +105,7 @@ def listado(item): item.action = "findvideos" item.contentType = "movie" pag = False #No hay paginación - elif item.extra == "peliculas" and not item.tipo: #Desde Menú principal + elif item.extra == "peliculas" and not item.tipo: #Desde Menún principal patron = '?' patron += '' patron_enlace = "/peli-descargar-torrent-\d+-(.*?)\.html" @@ -279,23 +279,23 @@ def listado(item): title_subs = "" item_local.language = "" - if "[subs" in title.lower() or "[vos" in title.lower() or "v.o.s" in title.lower(): + if "[subs" in title or "[Subs" in title or "[VOS" in title or "[VOSE" in title or "(V.O.S.E" in title: item_local.language = "VOS" - title = title.replace(" [Subs. integrados]", "").replace(" [subs. Integrados]", "").replace(" [VOSE", "").replace(" [VOS", "").replace(" (V.O.S.E)", "") - if "latino" in title.lower() or "argentina" in title.lower(): + title = title.replace(" [Subs. integrados]", "").replace(" [subs. Integrados]", "").replace(" [VOSE", "").replace(" (V.O.S.E)", "") + if "latino" in title or "Latino" in title or "rgentina" in title: item_local.language = "LAT" title = title.replace(" Latino", "").replace(" latino", "").replace(" Argentina", "").replace(" argentina", "") title = title.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "") - if "3d" in title.lower(): #Reservamos info para después de TMDB - title_subs = " 3D" + if "3d" in title or "3D" in title: #Reservamos info de subtítulos para después de TMDB + title_subs = "[3D]" title = title.replace(" [3d]", "").replace(" 3d", "").replace(" [3D]", "").replace(" 3D", "") - if "temp" in title.lower(): #Reservamos info de Temporada para después de TMDB + if "Temp" in title or "temp" in title: #Reservamos info de Temporada para después de TMDB title_subs = "[Temp.]" - if "audio" in title.lower(): #Reservamos info de audio para después de TMDB + if "Audio" in title or "audio" in title: #Reservamos info de subtítulos para después de TMDB title_subs = '[%s]' % scrapertools.find_single_match(title, r'(\[[a|A]udio.*?\])') title = re.sub(r'\[[a|A]udio.*?\]', '', title) - if "[dual" in title.lower(): + if "[Dual" in title or "[dual" in title: title_subs = "[Dual]" title = title = re.sub(r'\[D|dual.*?\]', '', title) @@ -325,7 +325,7 @@ def listado(item): if info != "" and not item_local.quality: item_local.quality = info - if "(hdrip" in title.lower() or "(br" in title.lower() or "(vhsrip" in title.lower() or "(dvdrip" in title.lower() or "(fullb" in title.lower() or "(blu" in title.lower() or "(4k" in title.lower() or "(hevc" in title.lower() or "(imax" in title.lower() or "extendida" in title.lower() or "[720p]" in title.lower() or "[1080p]" in title.lower(): + if "(HDRip" in title or "(BR" in title or "(HDRip" in title or "(VHSRip" in title or "(DVDRip" in title or "(FullB" in title or "(fullb" in title or "(Blu" in title or "(4K" in title or "(4k" in title or "(HEVC" in title or "(IMAX" in title or "Extendida" in title or "[720p]" in title or "[1080p]" in title: if not item_local.quality: item_local.quality = scrapertools.find_single_match(title, r'\(.*?\)?\(.*?\)') if not item_local.quality: @@ -333,10 +333,10 @@ def listado(item): title = re.sub(r'\(.*?\)?\(.*?\)', '', title) title = re.sub(r'[\[|\(].*?[\)|\]]', '', title) if not item_local.quality: - if "fullbluray" in title.lower(): + if "FullBluRay" in title or "fullbluray" in title: item_local.quality = "FullBluRay" title = title.replace("FullBluRay", "").replace("fullbluray", "") - if "4k" in title.lower() or "hdr" in title.lower(): + if "4K" in title or "4k" in title or "HDR" in title or "hdr" in title: item_local.quality = "4K" title = title.replace("4k-hdr", "").replace("4K-HDR", "").replace("hdr", "").replace("HDR", "").replace("4k", "").replace("4K", "") title = title.replace("(", "").replace(")", "").replace("[", "").replace("]", "") @@ -347,19 +347,15 @@ def listado(item): if item_local.extra == "peliculas": item_local.contentTitle = title - if "saga" in item_local.contentTitle.lower() or "saga" in item_local.contentSerieName.lower(): + if "Saga" in item_local.contentTitle or "Saga" in item_local.contentSerieName: item_local.contentTitle = item_local.contentTitle.replace("Saga ", "").replace("Saga", "") item_local.contentSerieName = item_local.contentSerieName.replace("Saga ", "").replace("Saga", "") title_subs = "[Saga]" - if "colecc" in item_local.contentTitle.lower() or "colecc" in item_local.contentSerieName.lower(): + if "Colecc" in item_local.contentTitle or "Colecc" in item_local.contentSerieName: item_local.contentTitle = item_local.contentTitle.replace("Coleccion ", "").replace("Coleccion", "") item_local.contentSerieName = item_local.contentSerieName.replace("Coleccion ", "").replace("Coleccion", "") title_subs = "[Coleccion]" - if "3D" in title_subs: #Si es 3D lo añadimos a calidad - item_local.quality = item_local.quality + title_subs - title_subs = '' - # Guardamos temporalmente info extra, si lo hay item_local.extra = item_local.extra + title_subs @@ -390,15 +386,6 @@ def listado(item): if item_local.infoLabels['year'] == "-": item_local.infoLabels['year'] = '' item_local.infoLabels['aired'] = '' - - # Preparamos el título para series, con los núm. de temporadas, si las hay - if item_local.contentType == "season" or item_local.contentType == "tvshow": - item_local.contentTitle= '' - - rating = '' - if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0': - rating = float(item_local.infoLabels['rating']) - rating = round(rating, 1) #Cambiamos el título si son capítulos múltiples if scrapertools.find_single_match(item_local.url, r'\d+x\d+.*?(\w+.*?\d+x\d+)'): @@ -415,13 +402,13 @@ def listado(item): elif item_local.contentType == "season" or item_local.contentType == "tvshow": if item_local.extra == "series" or temporada == "[Temp.]": - title = '%s - Temporada %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red][%s][/COLOR]' % (item_local.contentSerieName, str(item_local.contentSeason), scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, item_local.language) + title = '%s - Temporada %s [%s][%s][%s]' % (item_local.contentSerieName, str(item_local.contentSeason), scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), item_local.quality, item_local.language) else: - title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red][%s][/COLOR]' % (item_local.contentSerieName, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, item_local.language) + title = '%s [%s][%s][%s]' % (item_local.contentSerieName, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), item_local.quality, item_local.language) elif item_local.contentType == "movie": - title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red][%s][/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, item_local.language) - + title = '%s [%s][%s][%s]' % (title, str(item_local.infoLabels['year']), item_local.quality, item_local.language) + if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados: if item_local.contentType == "episode": if item_local.infoLabels['episodio_titulo']: @@ -437,9 +424,7 @@ def listado(item): title = '%s -%s-' % (item_local.contentSerieName, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')) title_subs = title_subs.replace("[", "-").replace("]", "-") - title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "") - title = re.sub(r'\s\[COLOR \w+\]\[\]\[\/COLOR\]', '', title) - title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title) + title = title.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "") item_local.title = title + title_subs item_local.contentTitle += title_subs #añadimos info adicional para display @@ -546,16 +531,13 @@ def listado_busqueda(item): # Limpiamos títulos, Sacamos datos de calidad, audio y lenguaje scrapedtitle = re.sub('\r\n', '', scrapedtitle).decode('iso-8859-1').encode('utf8').strip() title = scrapedtitle - title = title.replace("á", "a").replace("é", "e").replace("í", "i").replace("ó", "o").replace("ú", "u").replace("ü", "u").replace("�", "ñ").replace("ñ", "ñ") title_subs = "" - - #Determinamos y marcamos idiomas distintos del castellano item_local.language = "" - if "[vos" in title.lower() or "v.o.s" in title.lower() or "vo" in title.lower(): + if "[subs" in title or "[Subs" in title or "[VOS" in title or "[VOSE" in title or "(V.O.S.E" in title: item_local.language = "VOS" - title = title.replace(" [Subs. integrados]", "").replace(" [subs. Integrados]", "").replace(" [VOSE", "").replace(" [VOS", "").replace(" (V.O.S.E)", "").replace(" VO", "") - if "latino" in title.lower() or "argentina" in title.lower(): + title = title.replace(" [Subs. integrados]", "").replace(" [subs. Integrados]", "").replace(" [VOSE", "").replace(" (V.O.S.E)", "") + if "latino" in title or "Latino" in title or "rgentina" in title: item_local.language = "LAT" title = title.replace(" Latino", "").replace(" latino", "").replace(" Argentina", "").replace(" argentina", "") title = title.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "") @@ -570,11 +552,11 @@ def listado_busqueda(item): title = re.sub(r'\[[a|A]udio.*?\]', '', title) if "[Dual" in title or "[dual" in title: title_subs = "[Dual]" - title = title = re.sub(r'\[[D|d]ual.*?\]', '', title) + title = title = re.sub(r'\[D|dual.*?\]', '', title) if title.endswith('.'): title = title[:-1] - + title = title.replace("á", "a", 1).replace("é", "e", 1).replace("í", "i", 1).replace("ó", "o", 1).replace("ú", "u", 1).replace("ü", "u", 1) if not title: title = "dummy" title = scrapertools.remove_htmltags(title) @@ -673,25 +655,16 @@ def listado_busqueda(item): item_local.infoLabels['year'] = '' item_local.infoLabels['aired'] = '' - # Preparamos el título para series, con los núm. de temporadas, si las hay - if item_local.contentType == "season" or item_local.contentType == "tvshow": - item_local.contentTitle= '' - - rating = '' - if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0': - rating = float(item_local.infoLabels['rating']) - rating = round(rating, 1) - # Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados: if item_local.contentType == "season" or item_local.contentType == "tvshow": if item_local.extra == "series" or temporada == "[Temp.]": - title = '%s - Temporada %s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red][%s][/COLOR]' % (item_local.contentSerieName, str(item_local.contentSeason), scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, item_local.language) + title = '%s - Temporada %s [%s][%s][%s]' % (item_local.contentSerieName, str(item_local.contentSeason), scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), item_local.quality, item_local.language) else: - title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red][%s][/COLOR]' % (item_local.contentSerieName, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), rating, item_local.quality, item_local.language) + title = '%s [%s][%s][%s]' % (item_local.contentSerieName, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})'), item_local.quality, item_local.language) elif item_local.contentType == "movie": - title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red][%s][/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, item_local.language) + title = '%s [%s][%s][%s]' % (title, str(item_local.infoLabels['year']), item_local.quality, item_local.language) if config.get_setting("unify"): #Si Titulos Inteligentes SÍ seleccionados: if item_local.contentType == "season" or item_local.contentType == "tvshow": @@ -701,9 +674,7 @@ def listado_busqueda(item): title = '%s -%s-' % (item_local.contentSerieName, scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})')) title_subs = title_subs.replace("[", "-").replace("]", "-") - title = title.replace("--", "").replace(" []", "").replace("()", "").replace("(/)", "").replace("[/]", "") - title = re.sub(r'\s\[COLOR \w+\]\[\]\[\/COLOR\]', '', title) - title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title) + title = title.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "") item_local.title = title + title_subs item_local.contentTitle += title_subs #añadimos info adicional para display @@ -732,7 +703,7 @@ def findvideos(item): unify_status = config.get_setting("unify") # Obtener la información actualizada del Episodio, si no la hay - if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'): + if not item.infoLabels['tmdb_id']: tmdb.set_infoLabels(item, True) if item.post: #Puede traer datos para una llamada "post". De momento usado para documentales, pero podrían ser series @@ -749,83 +720,74 @@ def findvideos(item): #logger.debug(matches) for scrapedurl in matches: - #Generamos una copia de Item para trabajar sobre ella - item_local = item.clone() url = urlparse.urljoin(item.url, scrapedurl) # Localiza el .torrent en el siguiente link if not item.post: # Si no es llamada con Post, hay que bajar un nivel más torrent_data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(url).data) #logger.debug(torrent_data) - item_local.url = scrapertools.get_match(torrent_data, ">Pincha.*?Pincha.*?.*?)") # Prepara el patrón de búsqueda de: URL, título, fechas y dos valores mas sin uso - if '/serie' in item.url: + if item.extra == 'series': patron = ".*?]+>?([^>]+)<\/a><\/td>.*?" else: patron = "
.*?]+>(.*?)<\/td>.*?" @@ -862,7 +824,7 @@ def episodios(item): #logger.debug(data) # Recorremos todos los episodios generando un Item local por cada uno en Itemlist - for scrapedurl, scrapedtitle, year, name, value in matches: + for scrapedurl, scrapedtitle, fecha, name, value in matches: item_local = item.clone() item_local.action = "findvideos" item_local.contentType = "episode" @@ -875,9 +837,9 @@ def episodios(item): if scrapedtitle.endswith('.'): scrapedtitle = scrapedtitle[:-1] if not scrapedtitle: - scrapedtitle = "SIN TITULO" + scrapedtitle = "dummy" - if '/serie' in item.url: + if item.extra == 'series': title = scrapedtitle.lower() epi = title.split("x") if len(epi) > 1: @@ -893,9 +855,6 @@ def episodios(item): item_local.url = host + "/secciones.php?sec=descargas&ap=contar_varios" item_local.post = urllib.urlencode({name: value, "total_capis": total_capis, "tabla": tabla, "titulo": titulo_post}) - if year: - item_local.infoLabels['year'] = scrapertools.find_single_match(year, r'(\d{4})') - item_local.title = scrapedtitle itemlist.append(item_local.clone()) @@ -905,53 +864,41 @@ def episodios(item): # Pasada para maqullaje de los títulos obtenidos desde TMDB for item_local in itemlist: + title = item_local.title # Si no hay datos de TMDB, pongo los datos locales que conozco if item_local.infoLabels['aired']: - item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})') - - # Si son episodios múltiples, se toman los datos locales para nombre de episodio - if scrapertools.find_single_match(item_local.title, r'\d+x\d+.*?(\w+.*?\d+x\d+)'): - item_local.infoLabels['episodio_titulo'] = scrapertools.find_single_match(item_local.title, r'\d+x\d+.*?(\w+.*?\d+x\d+)') - item_local.title = '%sx%s - %s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2), item_local.infoLabels['episodio_titulo']) + year = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})') else: - item_local.title = '%sx%s -' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2)) + year = scrapertools.find_single_match(fecha, r'(\d{4})') + if not item_local.infoLabels['year']: + item_local.infoLabels['year'] = year - rating = '' - if item_local.infoLabels['rating'] and item_local.infoLabels['rating'] != '0.0': - rating = float(item_local.infoLabels['rating']) - rating = round(rating, 1) + # Si son episodios múltiples, se toman los datos locales para nombre de episodio + if scrapertools.find_single_match(title, r'\d+x\d+.*?(\w+.*?\d+x\d+)'): + item_local.infoLabels['episodio_titulo'] = scrapertools.find_single_match(title, r'\d+x\d+.*?(\w+.*?\d+x\d+)') #Preparamos el título para que sea compatible con Añadir Serie a Videoteca if item_local.infoLabels['episodio_titulo']: - if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie - item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName) - item_local.infoLabels['episodio_titulo'] = '%s %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName) - else: - item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo']) - if item_local.infoLabels['year']: - item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year']) - if rating: - item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], rating) + item_local.title = '%sx%s %s, %s [%s]' % (str(item_local.contentSeason), item_local.contentEpisodeNumber, item_local.infoLabels['episodio_titulo'], item_local.contentSerieName, year) + item_local.infoLabels['episodio_titulo'] = '%s [%s]' % (item_local.infoLabels['episodio_titulo'], year) else: - item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName) - item_local.title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red][%s][/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, item_local.language) + item_local.title = '%sx%s %s [%s]' % (str(item_local.contentSeason), item_local.contentEpisodeNumber, item_local.contentSerieName, year) + + #Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no + if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados: añadir calidad, lenguaje + item_local.title = '%s [%s][%s]' % (item_local.title, item_local.quality, item_local.language) #Quitamos campos vacíos - item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace(" []", "") - item_local.title = item_local.title.replace(" []", "") - item_local.title = re.sub(r'\s\[COLOR \w+\]\[\]\[\/COLOR\]', '', item_local.title) - item_local.title = re.sub(r'\s\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title) + if item_local.infoLabels['episodio_titulo']: + item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['episodio_titulo'].replace("[]", "") + item_local.title = item_local.title.replace("[]", "") #logger.debug("title=[" + item_local.title + "], url=[" + item_local.url + "], item=[" + str(item_local) + "]") if config.get_videolibrary_support() and len(itemlist) > 0: - title = '' - if item_local.infoLabels['temporada_num_episodios']: - title = ' [Temp. de %s ep.]' % item_local.infoLabels['temporada_num_episodios'] - - itemlist.append(item.clone(title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]" + title, action="add_serie_to_library", extra="episodios")) - + itemlist.append(item.clone(title="[COLOR yelow]Añadir esta serie a la videoteca[/COLOR]", action="add_serie_to_library", extra="episodios")) + return itemlist def search(item, texto):