TMDB: lock gestito globalmente
This commit is contained in:
+4
-3
@@ -21,9 +21,11 @@ import ast, copy, re, time
|
|||||||
from core import filetools, httptools, jsontools, scrapertools
|
from core import filetools, httptools, jsontools, scrapertools
|
||||||
from core.item import InfoLabels
|
from core.item import InfoLabels
|
||||||
from platformcode import config, logger, platformtools
|
from platformcode import config, logger, platformtools
|
||||||
|
import threading
|
||||||
|
|
||||||
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")]
|
||||||
|
lock = threading.Lock()
|
||||||
|
|
||||||
# ------------------------------------------------- -------------------------------------------------- --------
|
# ------------------------------------------------- -------------------------------------------------- --------
|
||||||
# Set of functions related to infoLabels.
|
# Set of functions related to infoLabels.
|
||||||
@@ -200,11 +202,8 @@ def set_infoLabels_itemlist(item_list, seekTmdb=False, idioma_busqueda=def_lang,
|
|||||||
|
|
||||||
if not config.get_setting('tmdb_active') and not forced:
|
if not config.get_setting('tmdb_active') and not forced:
|
||||||
return
|
return
|
||||||
import threading
|
|
||||||
|
|
||||||
# threads_num = config.get_setting("tmdb_threads", default=20)
|
# threads_num = config.get_setting("tmdb_threads", default=20)
|
||||||
# semaforo = threading.Semaphore(threads_num)
|
# semaforo = threading.Semaphore(threads_num)
|
||||||
lock = threading.Lock()
|
|
||||||
r_list = list()
|
r_list = list()
|
||||||
i = 0
|
i = 0
|
||||||
l_hilo = list()
|
l_hilo = list()
|
||||||
@@ -217,6 +216,8 @@ def set_infoLabels_itemlist(item_list, seekTmdb=False, idioma_busqueda=def_lang,
|
|||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
logger.error(traceback.format_exc(1))
|
logger.error(traceback.format_exc(1))
|
||||||
|
if lock and lock.locked():
|
||||||
|
lock.release()
|
||||||
# logger.debug(str(ret) + "item: " + _item.tostring())
|
# logger.debug(str(ret) + "item: " + _item.tostring())
|
||||||
# semaforo.release()
|
# semaforo.release()
|
||||||
r_list.append((_i, _item, ret))
|
r_list.append((_i, _item, ret))
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
|
|
||||||
def timer(self):
|
def timer(self):
|
||||||
while self.searchActions:
|
while self.searchActions:
|
||||||
|
if self.exit: return
|
||||||
percent = (float(self.count) / len(self.searchActions)) * 100
|
percent = (float(self.count) / len(self.searchActions)) * 100
|
||||||
self.LOADING.setVisible(False)
|
self.LOADING.setVisible(False)
|
||||||
self.PROGRESS.setPercent(percent)
|
self.PROGRESS.setPercent(percent)
|
||||||
@@ -325,15 +326,15 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
if self.exit: return
|
if self.exit: return
|
||||||
self.search_threads.append(executor.submit(self.get_channel_results, searchAction))
|
self.search_threads.append(executor.submit(self.get_channel_results, searchAction))
|
||||||
for ch in futures.as_completed(self.search_threads):
|
for ch in futures.as_completed(self.search_threads):
|
||||||
|
self.count += 1
|
||||||
if self.exit: return
|
if self.exit: return
|
||||||
if ch.result():
|
if ch.result():
|
||||||
self.count += 1
|
|
||||||
channel, valid, other = ch.result()
|
channel, valid, other = ch.result()
|
||||||
self.update(channel, valid, other)
|
self.update(channel, valid, other)
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
self.count = len(self.searchActions)
|
self.count = len(self.searchActions)
|
||||||
|
|
||||||
def get_channel_results(self, searchAction):
|
def get_channel_results(self, searchAction):
|
||||||
def search(text):
|
def search(text):
|
||||||
|
|||||||
Reference in New Issue
Block a user