From ff7e3a3fc021daf2f2d5a05475a38ba6e9ac82e5 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 20 Nov 2019 13:12:14 +0100 Subject: [PATCH] Revert "test processi in ricerca globale" This reverts commit 3f32c572 --- specials/search.py | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/specials/search.py b/specials/search.py index 0aa20fc9..d90dd664 100644 --- a/specials/search.py +++ b/specials/search.py @@ -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')