From a0b8a9fa93e7b34ce3b6ccd98e5df272f19dd2d0 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 23 Oct 2016 17:10:34 +0200 Subject: [PATCH] Monitor Kodi setting changes more closely --- resources/lib/kodimonitor.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 589115d6..7686d734 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -45,15 +45,17 @@ class KodiMonitor(xbmc.Monitor): """ Monitor the PKC settings for changes made by the user """ - currentLog = settings('logLevel') - if window('plex_logLevel') != currentLog: - # The log level changed, set new prop - log.debug("New log level: %s" % currentLog) - window('plex_logLevel', value=currentLog) - current_context = "true" if settings('enableContext') == "true" else "" - if window('plex_context') != current_context: - log.info("New context setting: %s", current_context) - window('plex_context', value=current_context) + # settings: window-variable + items = { + 'logLevel': 'plex_logLevel', + 'enableContext': 'plex_context', + 'plex_restricteduser': 'plex_restricteduser' + } + for settings_value, window_value in items.iteritems(): + if window(window_value) != settings(settings_value): + log.debug('PKC settings changed: %s is now %s' + % (settings_value, settings(settings_value))) + window(window_value, value=settings(settings_value)) @CatchExceptions(warnuser=False) def onNotification(self, sender, method, data):