From 882c592e4535aa93f17858a96fa85d06b4589290 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 3 Sep 2017 13:23:18 +0200 Subject: [PATCH] Fix detecting changes to PKC settings --- resources/lib/kodimonitor.py | 34 +++++++++++++++++----------------- resources/lib/state.py | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index c594d065..c86d1ff8 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -25,25 +25,25 @@ WINDOW_SETTINGS = { 'logLevel': 'plex_logLevel', 'enableContext': 'plex_context', 'plex_restricteduser': 'plex_restricteduser', - 'replaceSMB': 'replaceSMB', 'force_transcode_pix': 'plex_force_transcode_pix', 'fetch_pms_item_number': 'fetch_pms_item_number' } # settings: state-variable (state.py) +# Need to use getattr and setattr! STATE_SETTINGS = { - 'dbSyncIndicator': state.SYNC_DIALOG, - 'remapSMB': state.REMAP_PATH, - 'remapSMBmovieOrg': state.remapSMBmovieOrg, - 'remapSMBmovieNew': state.remapSMBmovieNew, - 'remapSMBtvOrg': state.remapSMBtvOrg, - 'remapSMBtvNew': state.remapSMBtvNew, - 'remapSMBmusicOrg': state.remapSMBmusicOrg, - 'remapSMBmusicNew': state.remapSMBmusicNew, - 'remapSMBphotoOrg': state.remapSMBphotoOrg, - 'remapSMBphotoNew': state.remapSMBphotoNew, - 'enableMusic': state.ENABLE_MUSIC, - 'enableBackgroundSync': state.BACKGROUND_SYNC + 'dbSyncIndicator': 'SYNC_DIALOG', + 'remapSMB': 'REMAP_PATH', + 'remapSMBmovieOrg': 'remapSMBmovieOrg', + 'remapSMBmovieNew': 'remapSMBmovieNew', + 'remapSMBtvOrg': 'remapSMBtvOrg', + 'remapSMBtvNew': 'remapSMBtvNew', + 'remapSMBmusicOrg': 'remapSMBmusicOrg', + 'remapSMBmusicNew': 'remapSMBmusicNew', + 'remapSMBphotoOrg': 'remapSMBphotoOrg', + 'remapSMBphotoNew': 'remapSMBphotoNew', + 'enableMusic': 'ENABLE_MUSIC', + 'enableBackgroundSync': 'BACKGROUND_SYNC' } ############################################################################### @@ -87,16 +87,16 @@ class KodiMonitor(Monitor): log.info('Requesting playlist/nodes refresh') plex_command('RUN_LIB_SCAN', 'views') # Reset the state variables in state.py - for settings_value, state_value in STATE_SETTINGS.iteritems(): + for settings_value, state_name in STATE_SETTINGS.iteritems(): new = settings(settings_value) if new == 'true': new = True elif new == 'false': new = False - if state_value != new: + if getattr(state, state_name) != new: log.debug('PKC state settings %s changed from %s to %s' - % (settings_value, state_value, new)) - state_value = new + % (settings_value, getattr(state, state_name), new)) + setattr(state, state_name, new) # Special cases, overwrite all internal settings state.FULL_SYNC_INTERVALL = int(settings('fullSyncInterval'))*60 state.BACKGROUNDSYNC_SAFTYMARGIN = int( diff --git a/resources/lib/state.py b/resources/lib/state.py index e7378f19..97da71c9 100644 --- a/resources/lib/state.py +++ b/resources/lib/state.py @@ -35,7 +35,7 @@ SYNC_DIALOG = True # Have we already checked the Kodi DB on consistency? KODI_DB_CHECKED = False # Is synching of Plex music enabled? -ENABLE_MUSIC = False +ENABLE_MUSIC = True # How often shall we sync? FULL_SYNC_INTERVALL = 0 # Background Sync enabled at all?