How to reload addon settings?
#1
Hello,

In my Addon i use the method onSettingsChanged. The method will be correct invoked but i get the old values from getSetting, though i changed the values in the configuration-dialog. Only if i restart KODI, i get the new values. However the file self 'settings.xml' respect the change immediately. My question is, how can i force to reload the settings?

Example:
def onSettingsChanged(self):
    xbmc.log('Settings changed', xbmc.LOGDEBUG)
    curVal = xbmcaddon.Addon().getSetting('myValue')
    xbmc.log('Current Value: %s' % curVal, xbmc.LOGDEBUG)


Thanks for any help.
Reply
#2
try if adding some sleep helps.
python:
def onSettingsChanged(self):
    xbmc.sleep(500)
    ...
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thank you for your reply.

I have try it but still i have no luck. I think it is not a problem of timing, because i can change different values subsequent and in the log the value never changed!

Any other suggestions?
Reply
#4
I have that setup and it works here. What do you mean by configuration-dialog? The addon settings? Have you tried using the addon id to get the settings?

xbmcaddon.Addon(addon_id)
Reply
#5
Yes, I mean the addon-settings dialog. I don't think xbmcaddon.Addon(addon_id) will anything improve, because i get with xbmcaddon.Addon().getAddonInfo('id') the right addon-id and the file settings.xml got the right values too. But i am surprised that you setup works, perhaps it's a matter of KODI version self. In my environment i use the KODI Version 17.6. So perhaps, i should try my addon with other KODI versions.

Can you recommend me a light addon which use onSettingsChanged, so i can test it in my environment ?

Thank you in advance
Reply
#6
This works for me:
Quote:class SettingMonitor(xbmc.Monitor):
    def __init__(self, *args, **kwargs):
        xbmc.Monitor.__init__(self)

    def onSettingsChanged(self):
        GetSettings()



monsettings = SettingMonitor()
Reply
#7
Thread moved to add-on development
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply

Logout Mark Read Team Forum Stats Members Help
How to reload addon settings?0