Concurrent modification of settings.xml issues
#1
For a screen-reader plugin you can choose the speech engine, the language, voice, etc. The settings.xml uses ACTION controls to get the addon
to present selection dialogs and do the actual setSetting(). This works okay, except that the addon does not see the changed setting values. Specifically, if the addon does an addon.setSetting, followed by an addon.getSetting for the same setting, the get will not return the value set. You have to exit the setting gui and reopen before the new values appear. It doesn't help to call xbmcaddon.Addon().getSetting(). I assume getSetting is reading the value from the settings.xml file, which is not written to until AFTER the settings gui closes.

Below is a snippet from the settings.xml for selecting the language. A similar method will be used to set the voice.

xml:
<setting help="" id="language.ResponsiveVoice" label="32016" parent="backend" type="string">
<control type="button" format="action">
<data>NotifyAll(service.xbmc.tts,SETTINGS.SETTING_DIALOG,&quot;[\&quot;ResponsiveVoice\&quot;,\&quot;language\&quot;]&quotWink</data>
</control>
<control format="action" type="button"/>
</setting>
To choose the voice, the addon needs to be able to  query the language value that the addon just set above, but so far I'm out of luck. Here is the code used to query the value immediately after setting in:

I could stash the value in the addon, but this is not very appealing. It seems this is a bug in the settings code.
Reply
#2
Hi,

haven't tested this myself but the Monitor class has a onSettingsChanged callback https://codedocs.xyz/xbmc/xbmc/group__py...42b6624e2c
Maybe you can use that to asynchronously change the voice.
Reply
#3
see the wiki: https://kodi.wiki/view/Add-on_settings_c...2action.22

there's two examples for action settings.
you need the second one for action settings that also store a value.
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
#4
(2020-06-10, 23:19)ronie Wrote: see the wiki: https://kodi.wiki/view/Add-on_settings_c...2action.22

there's two examples for action settings.
you need the second one for action settings that also store a value.

This works great, thanks. However, my problem is bigger. For this text to speech addon, I would like any settings changes to immediately be reflected in the voicing. So, if someone changes the volume with a slider, the user will be able to hear the change as the slider moves. Changes to voice engine, language, gender, pitch and speed are similar. As it is they don't hear the changes until they are completely finished and dismiss the settings dialog.

So far it looks like I will have to either figure out a way to have all (or most) settings do some sort of callback using an action, or I will have to implement a settings dialog in my addon. Doing the latter probably means that I don't get the benefits of the skin and will have too much custom code. Is there some way to capture settings changes without a lot of custom code? Ideally I would get intermediate values, like when someone uses a slider to change the volume so that the volume changes as the slider is moved. I assume that the built-in settings dialog is not extendable or customizable.
Reply
#5
nope, you'll have to write your own custom code to accomplish such a thing.
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

Logout Mark Read Team Forum Stats Members Help
Concurrent modification of settings.xml issues0