From a1cc62bb24cfc6038fdb9a5adcb7280d9642b1a5 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Sat, 1 May 2021 17:24:50 +0200 Subject: [PATCH] ops --- specials/globalsearch.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/specials/globalsearch.py b/specials/globalsearch.py index bbee8141..8d156f3f 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import threading import xbmc, xbmcgui, sys, channelselector, time, os from core.support import dbg, tmdb @@ -18,6 +19,7 @@ else: info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json def_lang = info_language[config.get_setting("info_language", "videolibrary")] close_action = False +update_lock = threading.Lock() def busy(state): @@ -330,12 +332,6 @@ class SearchWindow(xbmcgui.WindowXML): for searchAction in self.getActions(): if self.exit: return self.search_threads.append(executor.submit(self.get_channel_results, searchAction)) - for ch in futures.as_completed(self.search_threads): - self.count += 1 - if self.exit: return - if ch.result(): - channel, valid, other = ch.result() - self.update(channel, valid, other) except: import traceback logger.error(traceback.format_exc()) @@ -384,7 +380,12 @@ class SearchWindow(xbmcgui.WindowXML): import traceback logger.error(traceback.format_exc()) - return channel, valid, other if other else results + if self.exit: + return + update_lock.acquire() + self.count += 1 + self.update(channel, valid, other if other else results) + update_lock.release() def makeItem(self, url): item = Item().fromurl(url)