fix ricerca alternativa
This commit is contained in:
+34
-33
@@ -5,7 +5,7 @@ from core.tmdb import Tmdb
|
|||||||
from core.scrapertools import htmlclean, decodeHtmlentities
|
from core.scrapertools import htmlclean, decodeHtmlentities
|
||||||
from core.support import thumb, typo, match, Item
|
from core.support import thumb, typo, match, Item
|
||||||
from platformcode import config, platformtools
|
from platformcode import config, platformtools
|
||||||
from platformcode.logger import info, error
|
from platformcode import logger
|
||||||
|
|
||||||
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
||||||
def_lang = info_language[config.get_setting("info_language", "videolibrary")]
|
def_lang = info_language[config.get_setting("info_language", "videolibrary")]
|
||||||
@@ -14,9 +14,9 @@ langs = ['auto', 'de', 'fr', 'pt', 'it', 'es-MX', 'ca', 'en', 'es']
|
|||||||
langt = langs[config.get_setting('tmdb', "tvmoviedb")]
|
langt = langs[config.get_setting('tmdb', "tvmoviedb")]
|
||||||
if langt == 'auto': langt = def_lang
|
if langt == 'auto': langt = def_lang
|
||||||
langt_alt = langs[config.get_setting('tmdb_alternativo', "tvmoviedb")]
|
langt_alt = langs[config.get_setting('tmdb_alternativo', "tvmoviedb")]
|
||||||
langs = ['auto', 'co', 'cl', 'ar', 'mx', 'en', 'es']
|
# langs = ['auto', 'co', 'cl', 'ar', 'mx', 'en', 'es']
|
||||||
langf = langs[config.get_setting('filmaff', "tvmoviedb")]
|
# langf = langs[config.get_setting('filmaff', "tvmoviedb")]
|
||||||
if langf == 'auto': langf = 'en'
|
# if langf == 'auto': langf = 'en'
|
||||||
langs = ['auto', 'de-de', 'fr-fr', 'pt-pt', 'it-it', 'es-MX', 'ca-es', 'en', 'es']
|
langs = ['auto', 'de-de', 'fr-fr', 'pt-pt', 'it-it', 'es-MX', 'ca-es', 'en', 'es']
|
||||||
langi = langs[config.get_setting('imdb', "tvmoviedb")]
|
langi = langs[config.get_setting('imdb', "tvmoviedb")]
|
||||||
if langi == 'auto': langi = def_lang
|
if langi == 'auto': langi = def_lang
|
||||||
@@ -28,7 +28,7 @@ default_fan = filetools.join(config.get_runtime_path(), "fanart.jpg")
|
|||||||
|
|
||||||
|
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
info()
|
logger.info()
|
||||||
itemlist = [
|
itemlist = [
|
||||||
# TMDB
|
# TMDB
|
||||||
# item.clone(title=typo(config.get_localized_string(70021), 'bold'), action=""),
|
# item.clone(title=typo(config.get_localized_string(70021), 'bold'), action=""),
|
||||||
@@ -55,7 +55,7 @@ def configuracion(item):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def search_star(item):
|
def search_star(item):
|
||||||
info()
|
logger.info()
|
||||||
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
item.type='movie'
|
item.type='movie'
|
||||||
@@ -97,7 +97,7 @@ def search_(item):
|
|||||||
|
|
||||||
|
|
||||||
def searcing(item):
|
def searcing(item):
|
||||||
info()
|
logger.info()
|
||||||
|
|
||||||
new_item = Item(title=item.contentTitle, text=item.contentTitle.replace("+", " "), mode=item.contentType, infoLabels=item.infoLabels)
|
new_item = Item(title=item.contentTitle, text=item.contentTitle.replace("+", " "), mode=item.contentType, infoLabels=item.infoLabels)
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ def list_tmdb(item):
|
|||||||
itemlist.append(new_item)
|
itemlist.append(new_item)
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
if orden:
|
if orden:
|
||||||
itemlist.sort(key=lambda item: item.infoLabels["year"], reverse=True)
|
itemlist.sort(key=lambda item: item.infoLabels["year"], reverse=True)
|
||||||
@@ -625,7 +625,7 @@ def indices_tmdb(item):
|
|||||||
|
|
||||||
|
|
||||||
def filter(item):
|
def filter(item):
|
||||||
info()
|
logger.info()
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
list_controls = []
|
list_controls = []
|
||||||
@@ -705,7 +705,7 @@ def filtered(item, values):
|
|||||||
|
|
||||||
|
|
||||||
def musica_movie(item):
|
def musica_movie(item):
|
||||||
info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
data = match(item).data
|
data = match(item).data
|
||||||
matches = match(data, patron=r'<td class="left">([^<]+)<br><small>([^<]+)</small>.*?<td>(\d+:\d+).*?<p id="([^"]+)"').matches
|
matches = match(data, patron=r'<td class="left">([^<]+)<br><small>([^<]+)</small>.*?<td>(\d+:\d+).*?<p id="([^"]+)"').matches
|
||||||
@@ -729,7 +729,7 @@ def list_imdb(item):
|
|||||||
url = 'http://www.imdb.com/search/title?' + item.url
|
url = 'http://www.imdb.com/search/title?' + item.url
|
||||||
# data = httptools.downloadpage(url, headers=headers, replace_headers=True).data
|
# data = httptools.downloadpage(url, headers=headers, replace_headers=True).data
|
||||||
data = match(url, headers=headers).data
|
data = match(url, headers=headers).data
|
||||||
info(data)
|
logger.info(data)
|
||||||
|
|
||||||
# data = re.sub(r"\n|\r|\t| ", "", data)
|
# data = re.sub(r"\n|\r|\t| ", "", data)
|
||||||
# data = re.sub(r"\s{2}", " ", data)
|
# data = re.sub(r"\s{2}", " ", data)
|
||||||
@@ -812,7 +812,7 @@ def list_imdb(item):
|
|||||||
|
|
||||||
|
|
||||||
def filter_imdb(item):
|
def filter_imdb(item):
|
||||||
info()
|
logger.info()
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
list_controls = []
|
list_controls = []
|
||||||
@@ -1392,7 +1392,7 @@ def indices_imdb(item):
|
|||||||
|
|
||||||
|
|
||||||
# def filter_fa(item):
|
# def filter_fa(item):
|
||||||
# info()
|
# logger.info()
|
||||||
|
|
||||||
# from datetime import datetime
|
# from datetime import datetime
|
||||||
# list_controls = []
|
# list_controls = []
|
||||||
@@ -1494,7 +1494,7 @@ def indices_imdb(item):
|
|||||||
|
|
||||||
|
|
||||||
# def login_fa():
|
# def login_fa():
|
||||||
# info()
|
# logger.info()
|
||||||
|
|
||||||
# try:
|
# try:
|
||||||
# user = config.get_setting("usuariofa", "tvmoviedb")
|
# user = config.get_setting("usuariofa", "tvmoviedb")
|
||||||
@@ -1510,7 +1510,7 @@ def indices_imdb(item):
|
|||||||
# data = httptools.downloadpage("https://m.filmaffinity.com/%s/account.ajax.php?action=login" % langf, post=post).data
|
# data = httptools.downloadpage("https://m.filmaffinity.com/%s/account.ajax.php?action=login" % langf, post=post).data
|
||||||
|
|
||||||
# if "Invalid username" in data:
|
# if "Invalid username" in data:
|
||||||
# error("Error en el login")
|
# logger.error("Error en el login")
|
||||||
# return False, config.get_localized_string(70330)
|
# return False, config.get_localized_string(70330)
|
||||||
# else:
|
# else:
|
||||||
# post = "name=user-menu&url=http://m.filmaffinity.com/%s/main.php" % langf
|
# post = "name=user-menu&url=http://m.filmaffinity.com/%s/main.php" % langf
|
||||||
@@ -1519,11 +1519,11 @@ def indices_imdb(item):
|
|||||||
# userid = scrapertools.find_single_match(data, 'id-user=(\d+)')
|
# userid = scrapertools.find_single_match(data, 'id-user=(\d+)')
|
||||||
# if userid:
|
# if userid:
|
||||||
# config.set_setting("userid", userid, "tvmoviedb")
|
# config.set_setting("userid", userid, "tvmoviedb")
|
||||||
# info("Login correcto")
|
# logger.info("Login correcto")
|
||||||
# return True, ""
|
# return True, ""
|
||||||
# except:
|
# except:
|
||||||
# import traceback
|
# import traceback
|
||||||
# error(traceback.format_exc())
|
# logger.error(traceback.format_exc())
|
||||||
# return False, config.get_localized_string(70331)
|
# return False, config.get_localized_string(70331)
|
||||||
|
|
||||||
|
|
||||||
@@ -1644,7 +1644,7 @@ def indices_imdb(item):
|
|||||||
|
|
||||||
# def votar_fa(item):
|
# def votar_fa(item):
|
||||||
# # Window to select the vote
|
# # Window to select the vote
|
||||||
# info()
|
# logger.info()
|
||||||
|
|
||||||
# list_controls = []
|
# list_controls = []
|
||||||
# valores = {}
|
# valores = {}
|
||||||
@@ -1752,6 +1752,7 @@ def imagenes(item):
|
|||||||
# return itemlist
|
# return itemlist
|
||||||
elif "Imdb" in item.title:
|
elif "Imdb" in item.title:
|
||||||
try:
|
try:
|
||||||
|
from core import httptools
|
||||||
data = jsontools.load(httptools.downloadpage(item.images["imdb"]["url"], cookies=False).data)
|
data = jsontools.load(httptools.downloadpage(item.images["imdb"]["url"], cookies=False).data)
|
||||||
item.images["imdb"].pop("url")
|
item.images["imdb"].pop("url")
|
||||||
if data.get("allImages"):
|
if data.get("allImages"):
|
||||||
@@ -1920,7 +1921,7 @@ def acciones_trakt(item):
|
|||||||
ratings = []
|
ratings = []
|
||||||
try:
|
try:
|
||||||
for i, entry in enumerate(data):
|
for i, entry in enumerate(data):
|
||||||
info('ENTRY:',entry)
|
logger.info('ENTRY:',entry)
|
||||||
if i <= item.pagina: continue
|
if i <= item.pagina: continue
|
||||||
# try: entry = entry[item.args]
|
# try: entry = entry[item.args]
|
||||||
# except: pass
|
# except: pass
|
||||||
@@ -1974,7 +1975,7 @@ def acciones_trakt(item):
|
|||||||
if ratings[i]: new_item.title += typo("Trakt: %.2f | Tmdb: %.2f" % (ratings[i], new_item.infoLabels["rating"]), '_ [] color kod')
|
if ratings[i]: new_item.title += typo("Trakt: %.2f | Tmdb: %.2f" % (ratings[i], new_item.infoLabels["rating"]), '_ [] color kod')
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
if "page" in item.url and len(itemlist) == 20:
|
if "page" in item.url and len(itemlist) == 20:
|
||||||
page = match(item.url, patron=r'page=(\d+)').match
|
page = match(item.url, patron=r'page=(\d+)').match
|
||||||
@@ -1996,7 +1997,7 @@ def acciones_trakt(item):
|
|||||||
|
|
||||||
|
|
||||||
def order_list(item):
|
def order_list(item):
|
||||||
info()
|
logger.info()
|
||||||
|
|
||||||
list_controls = []
|
list_controls = []
|
||||||
valores1 = ['rating', 'added', 'title', 'released', 'runtime', 'popularity', 'percentage', 'votes']
|
valores1 = ['rating', 'added', 'title', 'released', 'runtime', 'popularity', 'percentage', 'votes']
|
||||||
@@ -2338,7 +2339,7 @@ def indices_mal(item):
|
|||||||
matches = match("https://myanimelist.net/anime.php", cookies=False, patronBlock=patronBlock, patron=patron).matches
|
matches = match("https://myanimelist.net/anime.php", cookies=False, patronBlock=patronBlock, patron=patron).matches
|
||||||
for url, title in matches:
|
for url, title in matches:
|
||||||
genero = title.split(" (", 1)[0]
|
genero = title.split(" (", 1)[0]
|
||||||
info(url_base, genero)
|
logger.info(url_base, genero)
|
||||||
thumbnail = url_base + genero.lower().replace(" ", "%20")
|
thumbnail = url_base + genero.lower().replace(" ", "%20")
|
||||||
if genero in ["Hentai", "Yaoi", "Yuri"] and not adult_mal:
|
if genero in ["Hentai", "Yaoi", "Yuri"] and not adult_mal:
|
||||||
continue
|
continue
|
||||||
@@ -2387,7 +2388,7 @@ def season_mal(item):
|
|||||||
thumb = thumb.replace("r/167x242/", "") + "l.jpg"
|
thumb = thumb.replace("r/167x242/", "") + "l.jpg"
|
||||||
itemlist.append(Item(channel=item.channel, action="details_mal", url=url, title=title, thumbnail=thumb, infoLabels=infoLabels, args=args, tipo=tipo, contentTitle=scrapedtitle, contentType=contentType, fanart=default_fan))
|
itemlist.append(Item(channel=item.channel, action="details_mal", url=url, title=title, thumbnail=thumb, infoLabels=infoLabels, args=args, tipo=tipo, contentTitle=scrapedtitle, contentType=contentType, fanart=default_fan))
|
||||||
else:
|
else:
|
||||||
patron = r'<a href="([^"]+)" class="link-title">(.*?)</a>.*?<span>(\? ep|\d+ ep).*?<div class="genres-inner js-genre-inner">(.*?)</div>.*?<div class="image".*?src="(.*?).jpg.*?<span class="preline">(.*?)</span>.*?<div class="info">\s*(.*?)\s*-.*?(\d{4}).*?title="Score">\s*(N/A|\d\.\d+)'
|
patron = r'<a href="([^"]+)" class="link-title">([^<]+)</a>.*?<span>(\? ep|\d+ ep).*?<div class="genres-inner js-genre-inner">(.*?)</div>.*?<div class="image".*?src="([^"]+).*?<span class="preline">(.*?)</span>.*?<div class="info">\s*(.*?)\s*-.*?(\d{4}).*?title="Score">\s*(N/A|\d\.\d+)'
|
||||||
matches = match(data, patron=patron).matches
|
matches = match(data, patron=patron).matches
|
||||||
for url, scrapedtitle, epis, scrapedgenres, thumbnail, plot, tipo, year, score in matches:
|
for url, scrapedtitle, epis, scrapedgenres, thumbnail, plot, tipo, year, score in matches:
|
||||||
if ("Hentai" in scrapedgenres or "Yaoi" in scrapedgenres or "Yuri" in scrapedgenres) and not adult_mal:
|
if ("Hentai" in scrapedgenres or "Yaoi" in scrapedgenres or "Yuri" in scrapedgenres) and not adult_mal:
|
||||||
@@ -2413,7 +2414,7 @@ def season_mal(item):
|
|||||||
else:
|
else:
|
||||||
args = "tv"
|
args = "tv"
|
||||||
contentType = "tvshow"
|
contentType = "tvshow"
|
||||||
thumbnail = thumbnail.replace("r/167x242/", "") + "l.jpg"
|
thumbnail = thumbnail.replace(".webp", ".jpg")
|
||||||
itemlist.append(Item(channel=item.channel, action="details_mal", url=url, title=title,
|
itemlist.append(Item(channel=item.channel, action="details_mal", url=url, title=title,
|
||||||
thumbnail=thumbnail, infoLabels=infoLabels, args=args, tipo=tipo,
|
thumbnail=thumbnail, infoLabels=infoLabels, args=args, tipo=tipo,
|
||||||
contentTitle=scrapedtitle, contentType=contentType,
|
contentTitle=scrapedtitle, contentType=contentType,
|
||||||
@@ -2487,7 +2488,7 @@ def detail_staff(item):
|
|||||||
patron_bio = r'<?<div class="spaceit_pad">(.*?)</td>'
|
patron_bio = r'<?<div class="spaceit_pad">(.*?)</td>'
|
||||||
bio = match(data, patron=patron_bio).match
|
bio = match(data, patron=patron_bio).match
|
||||||
bio = htmlclean(bio.replace("</div>", "\n"))
|
bio = htmlclean(bio.replace("</div>", "\n"))
|
||||||
info(bio)
|
logger.info(bio)
|
||||||
infoLabels = {'plot': bio}
|
infoLabels = {'plot': bio}
|
||||||
if not "No voice acting roles" in data:
|
if not "No voice acting roles" in data:
|
||||||
itemlist.append(Item(channel=item.channel, title=typo(config.get_localized_string(70374),'bold bullet'), action="", thumbnail=item.thumbnail, infoLabels=infoLabels))
|
itemlist.append(Item(channel=item.channel, title=typo(config.get_localized_string(70374),'bold bullet'), action="", thumbnail=item.thumbnail, infoLabels=infoLabels))
|
||||||
@@ -2550,7 +2551,7 @@ def searching_mal(item):
|
|||||||
title += " (%s)" % year
|
title += " (%s)" % year
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
if tipo == "Movie" or tipo == "OVA":
|
if tipo == "Movie" or tipo == "OVA":
|
||||||
infolabels["mediatype"] = "movie"
|
infolabels["mediatype"] = "movie"
|
||||||
@@ -2625,7 +2626,7 @@ def info_anidb(item, itemlist, url):
|
|||||||
|
|
||||||
|
|
||||||
def filter_mal(item):
|
def filter_mal(item):
|
||||||
info()
|
logger.info()
|
||||||
|
|
||||||
list_controls = []
|
list_controls = []
|
||||||
valores = {}
|
valores = {}
|
||||||
@@ -2703,7 +2704,7 @@ def callback_mal(item, values):
|
|||||||
|
|
||||||
def musica_anime(item):
|
def musica_anime(item):
|
||||||
# List available anime and songs similar to the anime title
|
# List available anime and songs similar to the anime title
|
||||||
info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|
||||||
data = match("http://www.freeanimemusic.org/song_search.php", post=item.post).data
|
data = match("http://www.freeanimemusic.org/song_search.php", post=item.post).data
|
||||||
@@ -2738,7 +2739,7 @@ def musica_anime(item):
|
|||||||
|
|
||||||
|
|
||||||
def login_mal(from_list=False):
|
def login_mal(from_list=False):
|
||||||
info()
|
logger.info()
|
||||||
from core import httptools
|
from core import httptools
|
||||||
from base64 import b64decode as bdec
|
from base64 import b64decode as bdec
|
||||||
|
|
||||||
@@ -2762,16 +2763,16 @@ def login_mal(from_list=False):
|
|||||||
response = httptools.downloadpage("https://myanimelist.net/login.php?from=%2F", post=post)
|
response = httptools.downloadpage("https://myanimelist.net/login.php?from=%2F", post=post)
|
||||||
|
|
||||||
if not re.search(r'(?i)' + user, response.data):
|
if not re.search(r'(?i)' + user, response.data):
|
||||||
error("Login failed")
|
logger.error("Login failed")
|
||||||
return False, config.get_localized_string(70330), user
|
return False, config.get_localized_string(70330), user
|
||||||
else:
|
else:
|
||||||
if generic:
|
if generic:
|
||||||
return False, config.get_localized_string(70393), user
|
return False, config.get_localized_string(70393), user
|
||||||
info("Correct login")
|
logger.info("Correct login")
|
||||||
return True, "", user
|
return True, "", user
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return False, config.get_localized_string(70331) , ''
|
return False, config.get_localized_string(70331) , ''
|
||||||
|
|
||||||
|
|
||||||
@@ -2799,7 +2800,7 @@ def cuenta_mal(item):
|
|||||||
|
|
||||||
def items_mal(item):
|
def items_mal(item):
|
||||||
# Scraper for personal lists
|
# Scraper for personal lists
|
||||||
info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
data = match(item.url).data
|
data = match(item.url).data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user