Limite thread tmdb eliminato

This commit is contained in:
mac12m99
2021-03-06 15:36:58 +01:00
parent 83d1914a2a
commit e7b4feae5e
3 changed files with 13 additions and 8 deletions

View File

@@ -66,6 +66,10 @@ otmdb_global = None
from core import db
def clean_cache():
db['tmdb_cache'].clear()
# The function name is the name of the decorator and receives the function that decorates.
def cache_response(fn):
logger.debug()
@@ -180,7 +184,8 @@ def set_infoLabels_itemlist(item_list, seekTmdb=False, idioma_busqueda=def_lang,
"""
Concurrently, it gets the data of the items included in the item_list.
The API has a limit of 40 requests per IP every 10 '' and that is why the list should not have more than 30 items to ensure the proper functioning of this function.
The API in the past had a limit of 40 requests per IP every 10 '', now there's no limit (https://developers.themoviedb.org/3/getting-started/request-rate-limiting)
If a limit will be re-added uncomment "tmdb_threads" and related code
@param item_list: list of Item objects that represent movies, series or chapters. The infoLabels attribute of each Item object will be modified including the extra localized data.
@type item_list: list
@@ -197,18 +202,18 @@ def set_infoLabels_itemlist(item_list, seekTmdb=False, idioma_busqueda=def_lang,
return
import threading
threads_num = config.get_setting("tmdb_threads", default=20)
semaforo = threading.Semaphore(threads_num)
# threads_num = config.get_setting("tmdb_threads", default=20)
# semaforo = threading.Semaphore(threads_num)
lock = threading.Lock()
r_list = list()
i = 0
l_hilo = list()
def sub_thread(_item, _i, _seekTmdb):
semaforo.acquire()
# semaforo.acquire()
ret = set_infoLabels_item(_item, _seekTmdb, idioma_busqueda, lock)
# logger.debug(str(ret) + "item: " + _item.tostring())
semaforo.release()
# semaforo.release()
r_list.append((_i, _item, ret))
for item in item_list:

View File

@@ -134,8 +134,8 @@ def run(item=None):
elif item.action == "script":
from core import tmdb
if tmdb.drop_bd():
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60011), time=2000, sound=False)
tmdb.clean_cache()
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60011), time=2000, sound=False)
elif item.action == "itemInfo":
platformtools.dialog_textviewer('Item info', item.parent)
elif item.action == "open_browser":

View File

@@ -90,7 +90,7 @@
<setting id="search_channels" type="action" label="59994" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiJzZXR0aW5nX2NoYW5uZWxfbmV3IiwNCiAgICAiY2hhbm5lbCI6InNlYXJjaCINCn0=)"/>
<setting label="70154" type="lsep"/>
<setting id="tmdb_active" default="true" visible="false"/>
<setting id="tmdb_threads" type="slider" option="int" range="5,5,30" label="70155" default="20"/>
<!-- <setting id="tmdb_threads" type="slider" option="int" range="5,5,30" label="70155" default="20"/>-->
<setting id="tmdb_plus_info" type="bool" label="70156" default="false"/>
<setting id="tmdb_cache" type="bool" label="70157" default="true"/>
<setting id="tmdb_cache_expire" type="select" lvalues="70158|70159|70160|70161|70170" label="70162" enable="eq(-1,true)" default="4"/>