tmdb: Ottimizzazione nella ricerca globale, no cache in sezione discover
This commit is contained in:
+3
-2
@@ -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