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.11.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:
https://kodi.wiki/view/Add-on_settings_conversion
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:
https://kodi.wiki/view/Add-on_settings_conversion

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
#10
(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.10.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:
https://kodi.wiki/view/Add-on_settings_conversion

Thanks for the great work on the conversion script.   I've run into one issue with it I wanted to highlight.  I ran it against my Kodi 18 settings.xml file and everything except in one section it set the parent value incorrectly which caused some formatting changes in Kodi 19 and some of the settings were greyed out.  Here's my Kodi 18 settings.xml file:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
    <category label="30339">
    <setting id="ssdp_timeout" type="number" label="30340" default="5"/>
    </category>
    <category label="30362">
    <setting id="content_pin" type="number" label="30363" option="hidden" default=""/>
    <setting id="caching" type="bool" label="30366" default="false"/>
    <setting id="kodiactor" type="bool" label="30367" default="true"/>
    <setting id="koditv" type="bool" label="30369" default="false"/>
    <setting id="kodichange" type="bool" label="30370" default="true"/>
    <setting id="kodisync" type="bool" label="30371" default="true"/>
    <setting id="mdupelog" type="bool" label="30374" default="false"/>
    <setting id="kodiclean" type="bool" label="30368" default="false"/>
    </category>
    <!-- View -->
    <category label="30300">
    <setting id="only_mezzmo_servers" type="bool" label="30350" default="true"/>
    <setting id="skinname" type="enum" label="30061" values="Estuary|Confluence|Aeon Nox 5" default="Estuary"/>
    
    <!--Confluence Skin-->
    <setting id="top_view_mode" type="enum" label="30349" lvalues="30345|30331|30332|30333" default="1" subsetting="true"  visible="eq(-1,1)" enable="eq(-1,1)"/>
    <setting id="folders_view_mode" type="enum" label="30342" lvalues="30345|30331|30332|30333" default="3" subsetting="true"  visible="eq(-2,1)" enable="eq(-2,1)"/>
    <setting id="files_view_mode" type="enum" label="30343" lvalues="30345|30331|30332|30333" default="3" subsetting="true"  visible="eq(-3,1)" enable="eq(-3,1)"/>
    <setting id="servers_view_mode" type="enum" label="30344" lvalues="30345|30331|30332|30333" default="3" subsetting="true"  visible="eq(-4,1)" enable="eq(-4,1)"/>
    <setting id="movies_view_mode" type="enum" label="30330" lvalues="30345|30331|30332|30333|30334|30335|30336|30337|30338" default="5" subsetting="true"  visible="eq(-5,1)" enable="eq(-5,1)"/>
    <setting id="episodes_view_mode" type="enum" label="30341" lvalues="30345|30331|30332|30333|30334|30335|30336|30337|30338" default="7" subsetting="true"  visible="eq(-6,1)" enable="eq(-6,1)"/>
    <setting id="songs_view_mode" type="enum" label="30365" lvalues="30345|30331|30332|30333|30334|30335|30336|30337|30338" default="3" subsetting="true"  visible="eq(-7,1)" enable="eq(-7,1)"/>
    
    <!--Aeon Nox 5 Skin-->
    <setting id="top_view_mode_aeon" type="labelenum" label="30349" values="Default AEON|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Icons|LowList|Episode|Wall|Gallery|Panel|RightList|BigList" default="List" subsetting="true"  visible="eq(-8,2)" enable="eq(-8,2)"/>
    <setting id="folders_view_mode_aeon" type="labelenum" label="30342" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Icons|LowList|Episode|Wall|Gallery|Panel|RightList|BigList|SongList|MyFlix|BigFan|BannerPlex|FanartList|Music_JukeBox|Fullscreen_Wall" default="List" subsetting="true"  visible="eq(-9,2)" enable="eq(-9,2)"/>
    <setting id="files_view_mode_aeon" type="labelenum" label="30343" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Icons|LowList|Episode|Wall|Gallery|Panel|RightList|BigList|SongList|MyFlix|BigFan|BannerPlex|FanartList|Music_JukeBox|Fullscreen_Wall" default="List" subsetting="true"  visible="eq(-10,2)" enable="eq(-10,2)"/>
    <setting id="servers_view_mode_aeon" type="labelenum" label="30344" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Icons|LowList|Episode|Wall|Gallery|Panel|RightList|BigList|SongList|MyFlix|BigFan|BannerPlex|FanartList|Music_JukeBox|Fullscreen_Wall" default="List" subsetting="true"  visible="eq(-11,2)" enable="eq(-11,2)"/>
    <setting id="movies_view_mode_aeon" type="labelenum" label="30330" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Icons|LowList|Episode|Wall|Gallery|Panel|RightList|BigList|SongList|MyFlix|BigFan|BannerPlex|FanartList|Music_JukeBox|Fullscreen_Wall" default="Shift" subsetting="true"  visible="eq(-12,2)" enable="eq(-12,2)"/>
    <setting id="episodes_view_mode_aeon" type="labelenum" label="30341" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Icons|LowList|Episode|Wall|Gallery|Panel|RightList|BigList|SongList|MyFlix|BigFan|BannerPlex|FanartList|Music_JukeBox|Fullscreen_Wall" default="Episode" subsetting="true"  visible="eq(-13,2)" enable="eq(-13,2)"/>
    <setting id="songs_view_mode_aeon" type="labelenum" label="30365" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Icons|LowList|Episode|Wall|Gallery|Panel|RightList|BigList|SongList|MyFlix|BigFan|BannerPlex|FanartList|Music_JukeBox|Fullscreen_Wall" default="List" subsetting="true"  visible="eq(-14,2)" enable="eq(-14,2)"/>
    
    <!--Estuary Skin-->
    <setting id="top_view_mode_estuary" type="labelenum" label="30349" values="Default ESTUARY|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Logo|Wall|LowList|BigList" default="List" subsetting="true"  visible="eq(-15,0)" enable="eq(-15,0)"/>
    <setting id="folders_view_mode_estuary" type="labelenum" label="30342" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Logo|Wall|LowList|BigList" default="List" subsetting="true"  visible="eq(-16,0)" enable="eq(-16,0)"/>
    <setting id="files_view_mode_estuary" type="labelenum" label="30343" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Logo|Wall|LowList|BigList" default="List" subsetting="true"  visible="eq(-17,0)" enable="eq(-17,0)"/>
    <setting id="servers_view_mode_estuary" type="labelenum" label="30344" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Logo|Wall|LowList|BigList" default="List" subsetting="true"  visible="eq(-18,0)" enable="eq(-18,0)"/>
    <setting id="movies_view_mode_estuary" type="labelenum" label="30330" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Logo|Wall|LowList|BigList" default="Shift" subsetting="true"  visible="eq(-19,0)" enable="eq(-19,0)"/>
    <setting id="episodes_view_mode_estuary" type="labelenum" label="30341" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Logo|Wall|LowList|Episode|BigList" default="Episode" subsetting="true"  visible="eq(-20,0)" enable="eq(-20,0)"/>
    <setting id="songs_view_mode_estuary" type="labelenum" label="30365" values="Default|List|InfoWall|Landscape|ShowCase1|ShowCase2|TriPanel|Posters|Shift|BannerWall|Logo|Wall|LowList|BigList" default="List" subsetting="true"  visible="eq(-21,0)" enable="eq(-21,0)"/>
    
    </category>
    <!-- Search -->
    <category label="30351">
    <setting id="search_video" type="bool" label="30352" default="true"/>
    <setting id="search_music" type="bool" label="30353" default="true"/>
    <setting id="search_photo" type="bool" label="30354" default="true"/>
    <setting id="search_title" type="bool" label="30360" default="true"/>
    <setting id="search_artist" type="bool" label="30356" default="true"/>
    <setting id="search_album" type="bool" label="30355" default="true"/>
    <setting id="search_tagline" type="bool" label="30357" default="true"/>
    <setting id="search_description" type="bool" label="30358" default="true"/>
    <setting id="search_keywords" type="bool" label="30359" default="true"/>
    <setting id="search_creator" type="bool" label="30364" default="true"/>
    </category>
</settings>

The problem is in the View section for anything other than the Confluence skin.  A sample output from the conversion is:

                <setting id="top_view_mode_aeon" type="string" label="30349" help="" parent="songs_view_mode">
                    <level>0</level>
                    <default>List</default>
                    <constraints>
                        <options>
                            <option label="Default">Default</option>
                            <option label="List">List</option>
                            <option label="InfoWall">InfoWall</option>
                            <option label="Landscape">Landscape</option>
                            <option label="ShowCase1">ShowCase1</option>
                            <option label="ShowCase2">ShowCase2</option>
                            <option label="TriPanel">TriPanel</option>
                            <option label="Posters">Posters</option>
                            <option label="Shift">Shift</option>
                            <option label="BannerWall">BannerWall</option>
                            <option label="Icons">Icons</option>
                            <option label="LowList">LowList</option>
                            <option label="Episode">Episode</option>
                            <option label="Wall">Wall</option>
                            <option label="Gallery">Gallery</option>
                            <option label="Panel">Panel</option>
                            <option label="RightList">RightList</option>
                            <option label="BigList">BigList</option>
                        </options>
                    </constraints>
                    <dependencies>
                        <dependency type="enable">
                            <condition operator="is" setting="skinname">2</condition>
                        </dependency>
                        <dependency type="visible">
                            <condition operator="is" setting="skinname">2</condition>
                        </dependency>
                    </dependencies>
                    <control type="spinner" format="string"/>
                </setting>

The parent is incorrect.  If I change it to skinname and the other settings options it works properly.  This may be an issue with the formatting of the View section of my Kodi 18 settings.xml file but when I load the Kodi 18 formatted settings.xml file under Kodi 19 Alpha 2 it works fine.


Jeff
Reply
#11
thanx, that's indeed a bug in the conversion script.
it should be fixed in this version:
script.settings-convert-0.0.11.zip
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
#12
(2020-10-17, 15:07)ronie Wrote: thanx, that's indeed a bug in the conversion script.
it should be fixed in this version:
script.settings-convert-0.0.11.zip

Thanks for the quick fix.  I've tested and it works perfect now.


Jeff
Reply
#13
The conversion script continues to work very well.  I do have a question.  On the output I see a help section like this example:

<setting id="bmdelay" type="integer" label="30377" help="">

I can't find any documentation for it and I tried just entering some text but nothing happened.  Is this a future or is there documentation on how help works ?


Jeff
Reply
#14
(2021-02-25, 12:56)jbinkley60 Wrote: The conversion script continues to work very well.  I do have a question.  On the output I see a help section like this example:

<setting id="bmdelay" type="integer" label="30377" help="">

I can't find any documentation for it and I tried just entering some text but nothing happened.  Is this a future or is there documentation on how help works ?


Jeff

This, in my opinion, is one of the best new features! You can add a localization number for help, just like the label and it will show up as a small help blurb at the bottom of the settings screen, to help a user understand what the setting does (example below):
Image
Reply
#15
(2021-02-26, 03:30)zachmorris Wrote:
(2021-02-25, 12:56)jbinkley60 Wrote: The conversion script continues to work very well.  I do have a question.  On the output I see a help section like this example:

<setting id="bmdelay" type="integer" label="30377" help="">

I can't find any documentation for it and I tried just entering some text but nothing happened.  Is this a future or is there documentation on how help works ?


Jeff

This, in my opinion, is one of the best new features! You can add a localization number for help, just like the label and it will show up as a small help blurb at the bottom of the settings screen, to help a user understand what the setting does (example below):
Image

Thanks.  I agree this is very helpful.  I found the issue.  Not all skins support the help feature yet.

Jeff
Reply



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