@@ -18,8 +18,7 @@ from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
from core.support import typo
|
||||
import cPickle, shutil
|
||||
from multiprocessing import Process
|
||||
multi = 'process'
|
||||
global_lock = threading.Lock()
|
||||
|
||||
addon = xbmcaddon.Addon('metadata.themoviedb.org')
|
||||
def_lang = addon.getSetting('language')
|
||||
@@ -574,15 +573,10 @@ def do_search(item, categories=None):
|
||||
logger.info("Búsqueda cancelada")
|
||||
return itemlist
|
||||
if multithread:
|
||||
if multi == 'threads':
|
||||
t = Thread(target=channel_search, args=[search_results, channel_parameters, tecleado],
|
||||
name=channel_parameters["title"])
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
else:
|
||||
t = Process(target=channel_search, args=[search_results, channel_parameters, tecleado],
|
||||
name=channel_parameters["title"])
|
||||
t.start()
|
||||
t = Thread(target=channel_search, args=[search_results, channel_parameters, tecleado],
|
||||
name=channel_parameters["title"])
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
threads.append(t)
|
||||
# Modo single Thread
|
||||
else:
|
||||
@@ -612,26 +606,19 @@ def search_progress(threads):
|
||||
import math
|
||||
progreso = platformtools.dialog_progress_bg(config.get_localized_string(20000), "")
|
||||
|
||||
if multi == 'threads':
|
||||
pendent = [a for a in threads if a.isAlive()]
|
||||
else:
|
||||
pendent = [a for a in threads if a.is_alive()]
|
||||
|
||||
pendent = [a for a in threads if a.isAlive()]
|
||||
if len(pendent) > 0: t = float(100) / len(pendent)
|
||||
while len(pendent) > 0:
|
||||
index = (len(threads) - len(pendent)) + 1
|
||||
percentage = int(math.ceil(index * t))
|
||||
|
||||
list_pendent_names = ['test' for a in pendent]
|
||||
list_pendent_names = [a.getName() for a in pendent]
|
||||
mensaje = config.get_localized_string(70282) % (", ".join(list_pendent_names))
|
||||
progreso.update(percentage,
|
||||
config.get_localized_string(60521) % (len(threads) - len(pendent) + 1, len(threads)),
|
||||
mensaje)
|
||||
time.sleep(0.5)
|
||||
if multi == 'threads':
|
||||
pendent = [a for a in threads if a.isAlive()]
|
||||
else:
|
||||
pendent = [a for a in threads if a.is_alive()]
|
||||
pendent = [a for a in threads if a.isAlive()]
|
||||
progreso.close()
|
||||
with open(os.path.join(res_dir, 'done'), 'w') as f:
|
||||
f.write('1')
|
||||
|
||||
Reference in New Issue
Block a user