New settings format for addons
#16
I tested a number of skins and so far only Estuary is displaying the help strings.  Looks like we'll have to nudge the skinners.


Jeff
Reply
#17
(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.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
@ronie Ran into one issue during conversion, the change below fixed it. Thanks for the script it works great!

line 154: default.py
from:
grouplabel = attributes['label']
to:
grouplabel = attributes.get('label','')
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Twitter | Help?
Reply
#18
Hi @ronie, in the Wiki setting conversion page https://kodi.wiki/view/Add-on_settings_conversion
is missing how to use / help to convert conditions based of infolabels like:

          <dependencies>
            <dependency type="enable">
              <condition on="property" name="InfoBool">system.platform.android</condition>
            </dependency>
          </dependencies>

can you add it?
it would be very useful
Development on Kodi Netflix add-on - Skills Python, C#, VB.NET
Reply
#19
@CastagnaIT thanx for the info, i wasn't aware that was possible.
i've added the info to the wiki page now.
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
#20
I've run into a settings issue between Kodi 18 and Kodi 19.  

Here's the Kodi 18 setting:

    <setting id="pastop" type="labelenum" label="30383" values="0|5|10|15|20|25|30|35|40|45|50|55|60" default="0"/>

The conversion script converted it to:

                <setting id="pastop" type="string" label="30383" help="">
                    <level>0</level>
                    <default>0</default>
                    <constraints>
                        <options>
                            <option label="0">0</option>
                            <option label="5">5</option>
                            <option label="10">10</option>
                            <option label="15">15</option>
                            <option label="20">20</option>
                            <option label="25">25</option>
                            <option label="30">30</option>
                            <option label="35">35</option>
                            <option label="40">40</option>
                            <option label="45">45</option>
                            <option label="50">50</option>
                            <option label="55">55</option>
                            <option label="60">60</option>
                        </options>
                    </constraints>
                    <control type="spinner" format="string"/>
                </setting>

This is not working with Kodi 19 and not showing the proper setting labels like 0,5, 10 etc... values.  Instead it is showing months and days like Jan, Fri,  The setting values are being stored properly in addon_data.  The Kodi 18 settings format works fine with Kodi 19.  If I force change the label;s to strings they display properly:

                <setting id="pastop" type="string" label="30383" help="30523">
                    <level>0</level>
                    <default>0</default>
                    <constraints>
                        <options>
                            <option label="A 0 ">0</option>
                            <option label="B 5 ">5</option>
                            <option label="C 10 ">10</option>
                            <option label="D 15 ">15</option>
                            <option label="E 20 ">20</option>
                            <option label="F 25 ">25</option>
                            <option label="G 30 ">30</option>
                            <option label="H 35 ">35</option>
                            <option label="I 40 ">40</option>
                            <option label="J 45 ">45</option>
                            <option label="K 50 ">50</option>
                            <option label="L 55 ">55</option>
                            <option label="M 60 ">60</option>
                        </options>
                    </constraints>
                    <control type="spinner" format="string"/>
                </setting>

If I go to language option labels it works too but I was preferring not to chew up a bunch of language labels just for this.  Is labelnum still supported in the new Kodi 19 settings format ?


Jeff
Reply
#21
i think you can ommit the label in case you want to display the values..

give this a shot:

<options>
    <option>0</option>
    <option>5</option>
    <option>10</option>
    ....
</options>
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
#22
(2021-05-26, 16:25)ronie Wrote: i think you can ommit the label in case you want to display the values..

give this a shot:

<options>
    <option>0</option>
    <option>5</option>
    <option>10</option>
    ....
</options>

That worked.  Thanks for the quick response.


Jeff
Reply
#23
Hey @ronie

I just converted some settings for my weather add on using your latest converter script (so handy!)

I didn't realise this addon was still using the old settings to be honest....thought I'd converted all of mine previously...but this time I'm having an issue.

This control works fine:


<setting id="Location1" type="action" label="32202" help="">
  <level>0</level>
  <default/>
  <constraints> <allowempty>true</allowempty> </constraints>
  <control type="button" format="action">
    <data>RunScript(weather.ozweather,Location1)</data>
  </control>
</setting>

This all is functionally fine, however the user can not see the value they've chosen from the location list....basically, the setting value is not displayed in the control once chosen (or if an existing value is in there).

I can't see anything in the wiki about getting the value to show?  Any tips??  Without the value showing it looks like it hasn't worked and users will definitely get confused...

(for reference, this old version settings worked fine:


<setting id="Location1" label="32111" type="action" action="RunScript($ID,Location1)" default=""/>
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#24
@bossanova808 the wiki lists two examples of an action type setting, it's the second one that you'll need to use.
https://kodi.wiki/view/Add-on_settings_c...2action.22

<setting id="test34" type="string" label="32034" help="">
    <level>0</level>
    <default/>
    <constraints>
        <allowempty>true</allowempty>
    </constraints>
    <control type="button" format="action">
        <data>RunScript(weather.yahoo,Location1)</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
#25
@ronie ah thanks - managed to look straight past that.  Working well now!
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply



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