From df6262ba26fae2cefaf403d71634c6b81ca8a548 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 2 May 2020 13:27:13 +0200 Subject: [PATCH] Revert "Possibile fix Per cambio Visuale" This reverts commit 67864db5 --- platformcode/platformtools.py | 31 ++++++++++--------------------- resources/settings.xml | 1 - service.py | 10 +++------- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 2719d38a..ce95056a 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -250,44 +250,32 @@ def getCurrentView(item=None, parent_item=None): info = xbmc.getInfoLabel('Container.ListItem(1).FileNameAndPath') item = Item().fromurl(info) if info else Item() parent_actions = ['peliculas', 'novedades', 'search', 'get_from_temp', 'channel_search', 'newest', 'discover_list', 'new_search'] - mode = None if parent_item.action == 'findvideos': - content = 'server' - mode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) - Type = '' if mode == 55 else 'addons' + return 'server', '' elif parent_item.action == 'mainlist': - content = 'channel' - mode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) - Type = '' if mode == 55 else 'addons' + return 'channel', '' elif (item.contentType in ['movie'] and parent_item.action in parent_actions) \ or (item.channel in ['videolibrary'] and parent_item.action in ['list_movies']) \ or (parent_item.channel in ['favorites'] and parent_item.action in ['mainlist']) \ or parent_item.action in ['now_on_tv', 'now_on_misc', 'now_on_misc_film', 'mostrar_perfil']: - content ='movie' - Type = 'movies' + return 'movie', 'movies' elif (item.contentType in ['tvshow'] and parent_item.action in parent_actions) \ or (item.channel in ['videolibrary'] and parent_item.action in ['list_tvshows']): - content = 'tvshow' - Type = 'tvshows' + return 'tvshow', 'tvshows' elif parent_item.action in ['get_seasons']: - content ='season' - Type = 'tvshows' + return 'season', 'tvshows' elif parent_item.action in ['episodios', 'get_episodes'] or item.contentType == 'episode': - content ='episode' - Type = 'tvshows' + return 'episode', 'tvshows' else: - content ='addon' - mode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) - Type = '' if mode == 55 else 'addons' + return 'addon', '' - return content, Type, mode if mode else int(config.get_setting('view_mode_%s' % content).split(',')[-1]) def set_view_mode(item, parent_item): def reset_view_mode(): @@ -299,14 +287,15 @@ def set_view_mode(item, parent_item): reset_view_mode() xbmcplugin.setContent(handle=int(sys.argv[1]), content='') xbmc.executebuiltin('Container.SetViewMode(%s)' % 55) - content, Type, mode= getCurrentView(item, parent_item) + content, Type = getCurrentView(item, parent_item) + mode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) if mode == 0: logger.info('default mode') mode = 55 xbmcplugin.setContent(handle=int(sys.argv[1]), content=Type) xbmc.executebuiltin('Container.SetViewMode(%s)' % mode) - logger.info('TYPE: ' + Type + ' - CONTENT: ' + content + ' - MODE:' + str(mode)) + logger.info('TYPE: ' + Type + ' - ' + 'CONTENT: ' + content) def render_items_old(itemlist, parent_item): diff --git a/resources/settings.xml b/resources/settings.xml index edcf5530..de18c2c3 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -134,7 +134,6 @@ - diff --git a/service.py b/service.py index c585c7e0..3e440373 100644 --- a/service.py +++ b/service.py @@ -359,15 +359,9 @@ def viewmodeMonitor(monitor): 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, mode = platformtools.getCurrentView() + content, Type = platformtools.getCurrentView() defaultMode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) if currentMode != defaultMode: - if content in ['addon', 'server', 'channel'] and currentMode != 55 and Type == '': - config.set_setting('view_mode_time', str(time.time())) - xbmc.executebuiltin("Container.Refresh") - if content in ['addon', 'server', 'channel'] and currentMode == 55 and time.time() - float(config.get_setting('view_mode_time')) > 3: - xbmc.executebuiltin("Container.Refresh") - logger.info('viewmode changed: ' + currentModeName + '-' + str(currentMode) + ' - content: ' + content) config.set_setting('view_mode_%s' % content, currentModeName + ', ' + str(currentMode)) except: @@ -401,6 +395,8 @@ if __name__ == "__main__": # Copia Custom code a las carpetas de Alfa desde la zona de Userdata from platformcode import custom_code custom_code.init() + from threading import Thread + Thread(target=viewmodeMonitor).start() if not config.get_setting("update", "videolibrary") == 2: check_for_update(overwrite=False)