Kodi Community Forum
xbmcaddon.getSetting not getting updated - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
--- Thread: xbmcaddon.getSetting not getting updated (/showthread.php?tid=290353)



xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-09

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?


RE: xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-09

Ok - this is weird. Switched to a new github branch (same code) and it's started working. I need to investigate further obviously.


RE: xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-10

Nope. Not working again. Would love to hear if anyone has got any thoughts on this.


RE: xbmcaddon.getSetting not getting updated - ronie - 2016-09-10

you might need to add a short sleep time between setting and getting the setting.


RE: xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-10

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.


RE: xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-24

Still haven't worked this out. Considering writing a small bit of code just to parse the xml file directly...


RE: xbmcaddon.getSetting not getting updated - ronie - 2016-09-24

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.


RE: xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-24

Ronie,

Thanks - I'm virtually certain that this is a fault in my code. I'll keep looking.


RE: xbmcaddon.getSetting not getting updated - phil65 - 2016-09-28

you need to update (=re-initialize) your xbmcaddon.Addon object ( _A_) in onSettingsChanged() I think.
Link to full code would help.


RE: xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-28

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.


RE: xbmcaddon.getSetting not getting updated - el_Paraguayo - 2016-09-30

Yes - that's going to work. Thank you.


This forum uses Lukasz Tkacz MyBB addons.