KoD 1.4.1
- ridisegnata la finestra della scelta film/serietv quando si aggiunge in videoteca\n- modifiche minori, qualche fix ai canali/server ed alla ricerca alternativa\n
This commit is contained in:
+3
-1
@@ -11,13 +11,15 @@ try:
|
||||
except ImportError:
|
||||
import urllib, urlparse, cookielib
|
||||
|
||||
|
||||
import os, time, json
|
||||
from threading import Lock
|
||||
from core.jsontools import to_utf8
|
||||
from platformcode import config, logger
|
||||
from core import scrapertools
|
||||
|
||||
# to surpress InsecureRequestWarning
|
||||
import urllib3
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
# Get the addon version
|
||||
__version = config.get_addon_version()
|
||||
|
||||
|
||||
+8
-7
@@ -82,7 +82,6 @@ def color(text, color):
|
||||
|
||||
def search(channel, item, texto):
|
||||
info(item.url + " search " + texto)
|
||||
if 'findhost' in dir(channel): channel.findhost()
|
||||
item.url = channel.host + "/?s=" + texto
|
||||
try:
|
||||
return channel.peliculas(item)
|
||||
@@ -318,7 +317,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
longtitle += s + parsedTitle.get('episode_title')
|
||||
item.contentEpisodeTitle = parsedTitle.get('episode_title')
|
||||
except:
|
||||
logger.debug('Error')
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
longtitle = typo(longtitle, 'bold')
|
||||
lang1, longtitle = scrapeLang(scraped, lang, longtitle)
|
||||
@@ -479,10 +479,10 @@ def scrape(func):
|
||||
# if url may be changed and channel has findhost to update
|
||||
if 'findhost' in func.__globals__ and not itemlist:
|
||||
info('running findhost ' + func.__module__)
|
||||
host = func.__globals__['findhost']()
|
||||
ch = func.__module__.split('.')[-1]
|
||||
host = config.get_channel_url(func.__globals__['findhost'], ch, True)
|
||||
|
||||
parse = list(urlparse.urlparse(item.url))
|
||||
from core import jsontools
|
||||
jsontools.update_node(host, func.__module__.split('.')[-1], 'url')
|
||||
parse[1] = scrapertools.get_domain_from_url(host)
|
||||
item.url = urlparse.urlunparse(parse)
|
||||
data = None
|
||||
@@ -491,6 +491,9 @@ def scrape(func):
|
||||
else:
|
||||
break
|
||||
|
||||
if action != 'play' and function != 'episodios' and 'patronMenu' not in args and item.contentType in ['movie', 'tvshow', 'episode', 'undefined'] and not disabletmdb:
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
if (pagination and len(matches) <= pag * pagination) or not pagination: # next page with pagination
|
||||
if patronNext and inspect.stack()[1][3] not in ['newest']:
|
||||
nextPage(itemlist, item, data, patronNext, function)
|
||||
@@ -509,8 +512,6 @@ def scrape(func):
|
||||
args=item.args,
|
||||
page=pag + 1,
|
||||
thumbnail=thumb()))
|
||||
if action != 'play' and function != 'episodios' and 'patronMenu' not in args and item.contentType in ['movie', 'tvshow', 'episode', 'undefined'] and not disabletmdb:
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
if anime:
|
||||
from platformcode import autorenumber
|
||||
|
||||
+5
-5
@@ -92,7 +92,7 @@ def cache_response(fn):
|
||||
# import time
|
||||
# start_time = time.time()
|
||||
|
||||
def wrapper(*args):
|
||||
def wrapper(*args, **kwargs):
|
||||
import base64
|
||||
|
||||
def check_expired(ts):
|
||||
@@ -143,7 +143,8 @@ def cache_response(fn):
|
||||
try:
|
||||
|
||||
# cache is not active
|
||||
if not config.get_setting("tmdb_cache", default=False):
|
||||
if not config.get_setting("tmdb_cache", default=False) or not kwargs.get('cache', True):
|
||||
logger.debug('no cache')
|
||||
result = fn(*args)
|
||||
else:
|
||||
|
||||
@@ -861,8 +862,7 @@ class Tmdb(object):
|
||||
|
||||
@staticmethod
|
||||
@cache_response
|
||||
def get_json(url):
|
||||
|
||||
def get_json(url, cache=True):
|
||||
try:
|
||||
result = httptools.downloadpage(url, cookies=False, ignore_response_code=True)
|
||||
|
||||
@@ -1045,7 +1045,7 @@ class Tmdb(object):
|
||||
% (type_search, "&".join(params)))
|
||||
|
||||
logger.info("[Tmdb.py] Searcing %s:\n%s" % (type_search, url))
|
||||
resultado = self.get_json(url)
|
||||
resultado = self.get_json(url, cache=False)
|
||||
if not isinstance(resultado, dict):
|
||||
resultado = ast.literal_eval(resultado.decode('utf-8'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user