Add settings monitor

Prompt for reset if playback mode change is detected
This commit is contained in:
angelblue05 2016-01-09 04:53:04 -06:00
parent b61b8ae894
commit f99efb2a83
3 changed files with 23 additions and 10 deletions

View file

@ -43,6 +43,28 @@ class KodiMonitor(xbmc.Monitor):
if library == "video":
utils.window('emby_kodiScan', clear=True)
def onSettingsChanged(self):
# Monitor emby settings
currentPath = utils.settings('useDirectPaths')
if utils.window('emby_pluginpath') != currentPath:
# Plugin path value changed. Offer to reset
self.logMsg("Changed to playback mode detected", 1)
utils.window('emby_pluginpath', value=currentPath)
resp = xbmcgui.Dialog().yesno(
heading="Playback mode change detected",
line1=(
"Detected the playback mode has changed. The database "
"needs to be recreated for the change to be applied. "
"Proceed?"))
if resp:
utils.reset()
currentLog = utils.settings('logLevel')
if utils.window('emby_logLevel') != currentLog:
# The log level changed, set new prop
self.logMsg("New log level: %s" % currentLog, 1)
utils.window('emby_logLevel', value=currentLog)
def onNotification(self, sender, method, data):
doUtils = self.doUtils

View file

@ -44,7 +44,6 @@ class UserClient(threading.Thread):
self.addonName = clientinfo.ClientInfo().getAddonName()
self.doUtils = downloadutils.DownloadUtils()
self.logLevel = int(utils.settings('logLevel'))
threading.Thread.__init__(self)
@ -411,15 +410,6 @@ class UserClient(threading.Thread):
while not monitor.abortRequested():
# Verify the log level
currLogLevel = self.getLogLevel()
if self.logLevel != currLogLevel:
# Set new log level
self.logLevel = currLogLevel
utils.window('emby_logLevel', value=str(currLogLevel))
self.logMsg("New Log Level: %s" % currLogLevel, 0)
status = utils.window('emby_serverStatus')
if status:
# Verify the connection status to server

View file

@ -55,6 +55,7 @@ class Service():
utils.window('emby_logLevel', value=str(logLevel))
utils.window('emby_kodiProfile', value=xbmc.translatePath("special://profile"))
utils.window('emby_pluginpath', value=utils.settings('useDirectPaths'))
# Initial logging
self.logMsg("======== START %s ========" % self.addonName, 0)