Kodi Community Forum

Full Version: xbmcaddon.getSetting not getting updated
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've got a weird issue on a service addon.

I'm using a Monitor instance to check for changes to settings and then get the script to update its settings with the new values. However, it looks like the changes aren't being picked up.

I retrieve the settings as follows:
Code:
_A_ = xbmcaddon.Addon()
_GET_ = _A_.getSetting

# in body of service

leagues = _GET_("watchedleagues")

The Monitor fires correctly when settings are changed but, if I print this setting value to the log I can see it's different to the value that's showed in the settings.xml file in my addon_data folder.

E.g. settings.xml shows:
Code:
<setting id="watchedleagues" value="[118996114]" />
but my debug log after the settings are updated shows
Code:
22:16:44 T:139767161288448   DEBUG: bbclivefootballscores: [118996114, 118996307, 118998135, 118996115, 118996117]
These are the values that were in place when Kodi started.

Are settings cached at all? Or is there any other reason why the setting retrieval isn't working?
Ok - this is weird. Switched to a new github branch (same code) and it's started working. I need to investigate further obviously.
Nope. Not working again. Would love to hear if anyone has got any thoughts on this.
you might need to add a short sleep time between setting and getting the setting.
I tried that. Rather than having the monitor trigger the read directly I:
  • put a Lock in place so updating the service settings didn't clash with the operation of the script (I didn't know it the monitor runs as a separate thread).
  • changed the Monitor to just set a flag which tells the service to update the settings on its next loop (every 5 seconds)
This didn't work.

Interestingly, if I change the settings again it still doesn't register the earlier changes so there's something more fundamental going wrong here.
Still haven't worked this out. Considering writing a small bit of code just to parse the xml file directly...
i can't reproduce this issue..

is the 'watchedleagues' setting changed by the user, through the addon settings,
or is your addon changing the value using setSetting() ?

if you can point me to your addon, i'll have a look.
Ronie,

Thanks - I'm virtually certain that this is a fault in my code. I'll keep looking.
you need to update (=re-initialize) your xbmcaddon.Addon object ( _A_) in onSettingsChanged() I think.
Link to full code would help.
OK - that's worth a try.

I'm snowed at work at the moment so I'll try when I get a chance to spend some proper time on this again.

If it still doesn't work, I'll link to the latest version of the code, but I certainly don't want to waste anyone's time at the moment.

Thanks for your help.
Yes - that's going to work. Thank you.