Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
xbmcaddon.getSetting not getting updated
#1
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?
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#2
Ok - this is weird. Switched to a new github branch (same code) and it's started working. I need to investigate further obviously.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#3
Nope. Not working again. Would love to hear if anyone has got any thoughts on this.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#4
you might need to add a short sleep time between setting and getting the setting.
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
#5
Shocked 
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.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#6
Still haven't worked this out. Considering writing a small bit of code just to parse the xml file directly...
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#7
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.
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
#8
Ronie,

Thanks - I'm virtually certain that this is a fault in my code. I'll keep looking.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#9
you need to update (=re-initialize) your xbmcaddon.Addon object ( _A_) in onSettingsChanged() I think.
Link to full code would help.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#10
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.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#11
Yes - that's going to work. Thank you.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcaddon.getSetting not getting updated0
This forum uses Lukasz Tkacz MyBB addons.