From 3cd76fa29188e8b0ceb351a37ed2ecb12c8d00aa Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 5 Feb 2017 14:10:14 +0100 Subject: [PATCH] Fix screensaver not toggling back after full sync - Fixes #197 --- resources/lib/librarysync.py | 1 + resources/lib/utils.py | 28 +++++----------------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 279f679f..6c95b56d 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -605,6 +605,7 @@ class LibrarySync(Thread): except Exception as e: # Empty movies, tv shows? log.error('Path hack failed with error message: %s' % str(e)) + setScreensaver(value=screensaver) return True def processView(self, folderItem, kodi_db, plex_db, totalnodes): diff --git a/resources/lib/utils.py b/resources/lib/utils.py index e7931e32..34b34c1e 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -278,33 +278,15 @@ def create_actor_db_index(): def getScreensaver(): # Get the current screensaver value - query = { + params = {'setting': "screensaver.mode"} + return JSONRPC('Settings.getSettingValue').execute(params)['result']['value'] - 'jsonrpc': "2.0", - 'id': 0, - 'method': "Settings.getSettingValue", - 'params': { - - 'setting': "screensaver.mode" - } - } - return loads(xbmc.executeJSONRPC(dumps(query)))['result']['value'] def setScreensaver(value): # Toggle the screensaver - query = { - - 'jsonrpc': "2.0", - 'id': 0, - 'method': "Settings.setSettingValue", - 'params': { - - 'setting': "screensaver.mode", - 'value': value - } - } - log.debug("Toggling screensaver: %s %s" - % (value, xbmc.executeJSONRPC(dumps(query)))) + params = {'setting': "screensaver.mode", 'value': value} + log.debug('Toggling screensaver to "%s": %s' + % (value, JSONRPC('Settings.setSettingValue').execute(params))) def reset():