From 5229deeaf26da72770b1b0421d44da20f1bc8858 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Wed, 29 Sep 2021 16:46:30 +0200 Subject: [PATCH] - Fix sqlitedict - Probabile fix Visualizzazioni --- lib/sqlitedict.py | 4 ++-- platformcode/platformtools.py | 35 ++++++++++++++++++----------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lib/sqlitedict.py b/lib/sqlitedict.py index 8e6cc03a..2e0db32b 100644 --- a/lib/sqlitedict.py +++ b/lib/sqlitedict.py @@ -39,6 +39,7 @@ from threading import Thread __version__ = '1.7.0.dev0' import xbmc +kodi_monitor = xbmc.Monitor() major_version = sys.version_info[0] if major_version < 3: # py <= 2.x @@ -416,7 +417,6 @@ class SqliteMultithread(Thread): self.log = logging.getLogger('sqlitedict.SqliteMultithread') self.start() - self.kodi_monitor = xbmc.Monitor() def run(self): try: @@ -443,7 +443,7 @@ class SqliteMultithread(Thread): self._sqlitedict_thread_initialized = True res = None - while not self.kodi_monitor.abortRequested(): + while not kodi_monitor.abortRequested(): req, arg, res, outer_stack = self.reqs.get() if req == '--close--': assert res, ('--close-- without return queue', res) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 8f5635b3..39a4a83e 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -383,23 +383,24 @@ def render_items(itemlist, parent_item): def viewmodeMonitor(): - try: - currentModeName = xbmc.getInfoLabel('Container.Viewmode') - win = xbmcgui.Window(xbmcgui.getCurrentWindowId()) - currentMode = int(win.getFocusId()) - if currentModeName and 'plugin.video.kod' in xbmc.getInfoLabel('Container.FolderPath') and currentMode < 1000 and currentMode >= 50: # inside addon and in itemlist view - content, Type = getCurrentView() - if content: - defaultMode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) - if currentMode != defaultMode: - logger.debug('viewmode changed: ' + currentModeName + '-' + str(currentMode) + ' - content: ' + content) - config.set_setting('view_mode_%s' % content, currentModeName + ', ' + str(currentMode)) - dialog_notification(config.get_localized_string(70153), - config.get_localized_string(70187) % (content, currentModeName), - sound=False) - except: - import traceback - logger.error(traceback.print_exc()) + if get_window() == 'WINDOW_VIDEO_NAV': + try: + currentModeName = xbmc.getInfoLabel('Container.Viewmode') + win = xbmcgui.Window(xbmcgui.getCurrentWindowId()) + currentMode = int(win.getFocusId()) + if currentModeName and 'plugin.video.kod' in xbmc.getInfoLabel('Container.FolderPath') and currentMode < 1000 and currentMode >= 50: # inside addon and in itemlist view + content, Type = getCurrentView() + if content: + defaultMode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) + if currentMode != defaultMode: + logger.debug('viewmode changed: ' + currentModeName + '-' + str(currentMode) + ' - content: ' + content) + config.set_setting('view_mode_%s' % content, currentModeName + ', ' + str(currentMode)) + dialog_notification(config.get_localized_string(70153), + config.get_localized_string(70187) % (content, currentModeName), + sound=False) + except: + import traceback + logger.error(traceback.print_exc()) def getCurrentView(item=None, parent_item=None):