New settings format for addons
#1
During the development of Kodi Leia, we've added support for addons to use the same settings format as Kodi itself uses.
Due to some initial bugs that couldn't be fixed in time before the v18 release, we've never promoted the use of this settings format for addons.

Over the past few months, these issues have been fixed.
If you're running a nightly v19 build and plan to submit your addon to the addon repo for Matrix,
there shouldn't be any reason to stop you from migrating your settings.xml file to the new format.

Here's an addon that will do (or at least try to) the hard work for you:
script.settings-convert-0.0.9.zip
(please make a backup of your settings.xml file before running this script)


In case you prefer not to depend on automated tools and rather do it manually, there's a wiki page where i tried to cover as much as i could think of:
Add-on_settings_conversion (wiki)
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
#2
(2019-12-16, 03:03)ronie Wrote: During the development of Kodi Leia, we've added support for addons to use the same settings format as Kodi itself uses.
Due to some initial bugs that couldn't be fixed in time before the v18 release, we've never promoted the use of this settings format for addons.

Over the past few months, these issues have been fixed.
If you're running a nightly v19 build and plan to submit your addon to the addon repo for Matrix,
there shouldn't be any reason to stop you from migrating your settings.xml file to the new format.

Here's an addon that will do (or at least try to) the hard work for you:
script.settings-convert-0.0.8.zip
(please make a backup of your settings.xml file before running this script)


In case you prefer not to depend on automated tools and rather do it manually, there's a wiki page where i tried to cover as much as i could think of:
Add-on_settings_conversion (wiki)

Thanks for the script. It didn't work for me right away, giving an error on an unfound mask type. I had to add:

elif attributes['type'] == 'file':
mask = 'file'

And then it worked pretty well. I will note that settings that of type 'string' with selectable options didn't seem to work as they did before, and the default value wasn't recognized for those settings types (the setting remained blank and wouldn't show the default value by default). I changed these settings to 'integer' in my addon which allows for language translation and easier boolean operations, so it wasn't a big issue for me.

I also noticed the 'help' string added to both categories and individual settings. In the latest v19 Kodi with Estuary, the help strings showed up for each category, but they currently don't for individual settings. That would be excellent if this was added.

One last question. I'm trying to make my addon work with py3/v19 currently, but then wanted to potentially backport all my changes for a v18/v19 compatible addon. Will these settings eventually be recognized in v18?
Reply
#3
(2020-03-11, 00:36)zachmorris Wrote: It didn't work for me right away, giving an error on an unfound mask type. I had to add:
thanx for the report!
i'll look into that and see if i can come up with a fix.
 
(2020-03-11, 00:36)zachmorris Wrote: I will note that settings that of type 'string' with selectable options didn't seem to work as they did before, and the default value wasn't recognized for those settings types (the setting remained blank and wouldn't show the default value by default).
could you please provide an example of such an (old style) setting?
 
(2020-03-11, 00:36)zachmorris Wrote: I also noticed the 'help' string added to both categories and individual settings. In the latest v19 Kodi with Estuary, the help strings showed up for each category, but they currently don't for individual settings.
hmm, that works fine for me. this might be an issue on your end... but again, code examples work best here ;-)
 
(2020-03-11, 00:36)zachmorris Wrote: Will these settings eventually be recognized in v18? 
nope, i don't think that's going to happen. afaik the changes would be too intrusive to backport.
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-03-11, 02:33)ronie Wrote: please provide an example of such an (old style) setting? 

Here's one example.

(2020-03-11, 02:33)ronie Wrote: hmm, that works fine for me. this might be an issue on your end... but again, code examples work best here ;-)

I figured out the issue. The help message has to be in the strings.po file. It currently doesn't display strings, so if I enter:

<setting help="30522" id="my_setting" label="30010" type="integer">
Thats works with a string.po msg, but if I enter:

<setting help="This is a test" id="my_setting" label="30010" type="integer">
Then it doesn't work.

(2020-03-11, 02:33)ronie Wrote: nope, i don't think that's going to happen. afaik the changes would be too intrusive to backport.
Thats what I figured, thanks!
Reply
#5
(2020-03-11, 03:51)zachmorris Wrote:
(2020-03-11, 02:33)ronie Wrote: please provide an example of such an (old style) setting? 
Here's one example. 

 thanx, i've fixed that issue (and the crash as well) in the latest version. it's available in the first post.
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
#6
@ronie With the new settings.xml format, how would we do this:

<setting label="30869" type="action" action="InstallAddon(service.upnext)" option="close" visible="!System.HasAddon(service.upnext)"/>

I could not find examples that uses System.HasAddon() as a conditional.
Reply
#7
not possible i think, as far as i know you can not use an infobool as a condition.
@Montellese would be able to tell for sure.
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
The text to speech addon sent a message to the addon to have it display a list of dynamic values for the user to choose from

<setting label="32002" type="action" id="backend" action="NotifyAll(service.xbmc.tts,SETTINGS.BACKEND_DIALOG)"/>

After converting to the new format this became:

<setting help="" id="backend" label="32002" type="action">
<level>0</level>
<data>NotifyAll(service.xbmc.tts,SETTINGS.BACKEND_DIALOG)</data>
<constraints> <allowempty>true</allowempty> </constraints>
<control format="action" type="button"/>
</setting>

This didn't work very well since the property 'backend' is not a real property (or at least it was not created in settings.xml). The old settings format created 'backend' as a String value, which the addon stored the value that the user chose. I tried changing the <control> format to string and text, but that didn't help. Finally I created a separate property 'backend_action' for the button. I also defined 'backend' as a string property. I also found that the <control> definition was not needed:

<setting help="" id="backend_action" label="32002" type="action">
<level>0</level>
<data>NotifyAll(service.xbmc.tts,SETTINGS.BACKEND_DIALOG)</data>
<constraints> <allowempty>true</allowempty> </constraints>
</setting>

<setting type="text" id="backend" label="Current backend" help="">
<level>0</level>
<default></default>
<constraints>
<allowempty>true</allowempty>
</constraints>
<visible>true</visible>
</setting>

However, this is less that desirable. Using the old settings format, the Action property value was treated as a string and displayed as a string. I worked around this by having a separate property 'backend' above to display the value, however, I have yet to find a way to mark the property as read-only.
Reply
#9
there are two types of 'action' settings in the new format:
- a setting for 'pure' actions, that do not store a value
- a setting for actions that also store a value
see: https://kodi.wiki/view/Add-on_settings_c...2action.22

i guess the second one is what you're after
<setting id="backend" type="string" label="32002" help="">
    <level>0</level>
    <default/>
    <constraints>
        <allowempty>true</allowempty>
    </constraints>
    <control type="button" format="action">
        <data>NotifyAll(service.xbmc.tts,SETTINGS.BACKEND_DIALOG)</data>
    </control>
</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
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
New settings format for addons00
This forum uses Lukasz Tkacz MyBB addons.