Kodi Community Forum

Full Version: Bad convertion to the new Settings.xml format (Multiple options with numbers values)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I used the 'script.settings-convert' in order to convert to the new format.
But there is a problem with multiple selection when all the values options were numbers.
It takes the number value and put it automatically also as a label value,
But the number label value is translated to general string from kodi or something (Like categoires, days names etc.)
"0" = "View: Icons", "1" = "Pictures", "2" - "Music", ...

* This automatic behavior is good when the options are strings/text, but when they are numbers it's not good.

Old settings.xml: https://paste.ubuntu.com/p/FbC7tpDtyV
New settings.xml: https://paste.ubuntu.com/p/G5DRM9h4Xj

Focus on: 
<category id="טלויזיה" label="30600" help="">
            <group id="1" label="30601">

On the old it's like this (One of them for example)
<setting id="ch_11" type="labelenum" label="30602" values="0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|19|20|100" default="1" />

On the new:
                <setting id="ch_11" type="string" label="30602" help="">
                    <level>0</level>
                    <default>1</default>
                    <constraints>
                        <options>
                            <option label="0">0</option>
                            <option label="1">1</option>
                            <option label="2">2</option>
                            <option label="3">3</option>
                            <option label="4">4</option>
                            <option label="5">5</option>
                            <option label="6">6</option>
                            <option label="7">7</option>
                            <option label="8">8</option>
                            <option label="9">9</option>
                            <option label="10">10</option>
                            <option label="11">11</option>
                            <option label="12">12</option>
                            <option label="13">13</option>
                            <option label="14">14</option>
                            <option label="15">15</option>
                            <option label="16">16</option>
                            <option label="17">17</option>
                            <option label="19">19</option>
                            <option label="20">20</option>
                            <option label="100">100</option>
                        </options>
                    </constraints>
                    <control type="spinner" format="string"/>
                </setting>

Sometimes the options are numbers but represnt labels from languages files (using lvalues):
In this case the labels are equal to the values and the options converted to numbers.
    <category label="30200">
        <setting id="reshetSortBy" type="enum" label="30001" lvalues="30002|30003" default="0" />
        <setting id="reshet_res" type="text" label="30023" default="" />
    </category>

This was converted correctly:
<category id="רשת" label="30200" help="">
            <group id="1">
                <setting id="reshetSortBy" type="integer" label="30001" help="">
                    <level>0</level>
                    <default>0</default>
                    <constraints>
                        <options>
                            <option label="30002">0</option>
                            <option label="30003">1</option>
                        </options>
                    </constraints>
                    <control type="spinner" format="string"/>
                </setting>
                <setting id="reshet_res" type="string" label="30023" help="">
                    <level>0</level>
                    <default/>
                    <constraints>
                        <allowempty>true</allowempty>
                    </constraints>
                    <control type="edit" format="string">
                        <heading>30023</heading>
                    </control>
                </setting>
            </group>
        </category>

So the problem is with the "option's label" tags, it show some irrelevant strings,
while it should shows numbers as an options (Like the values in the old one),
These labels are not needed here when the values are numbers that are not exist in the strings.po

How can I show the values as labels automatically as it was?
Am I must adding it now to the strings.po and replace all the numbers values to string.po labels IDs using lvalues before running the convertor?
(31000 = 0, 31001 = 1, ....)
Must be type=integer, not string at the top.

<setting help="95012" id="id_tag" label="55009" type="integer">
    <level>0</level>
    <default>0</default>
    <constraints>
        <options>
            <option label="55010">0</option>
            <option label="55011">1</option>
            <option label="55017">2</option>
            <option label="55012">3</option>
            <option label="55018">4</option>
            <option label="55013">5</option>
            <option label="55019">6</option>
            <option label="55014">7</option>
            <option label="55020">8</option>
            <option label="55021">9</option>
            <option label="55022">10</option>
            <option label="55023">11</option>
        </options>
    </constraints>
    <control format="string" type="spinner"/>
</setting>
(2021-10-10, 13:02)M89SE Wrote: [ -> ]Must be type=integer, not string at the top.

<setting help="95012" id="id_tag" label="55009" type="integer">
    <level>0</level>
    <default>0</default>
    <constraints>
        <options>
            <option label="55010">0</option>
            <option label="55011">1</option>
            <option label="55017">2</option>
            <option label="55012">3</option>
            <option label="55018">4</option>
            <option label="55013">5</option>
            <option label="55019">6</option>
            <option label="55014">7</option>
            <option label="55020">8</option>
            <option label="55021">9</option>
            <option label="55022">10</option>
            <option label="55023">11</option>
        </options>
    </constraints>
    <control format="string" type="spinner"/>
</setting>

This is not the real problem.
The annoying issue is that it requires to add the numeric labels to the language files and change all the "lable=" values in the setting to their ID from the language files.
This is more annoying when you have a lot of settings such I posted here.