Difference between revisions of "Add-on settings conversion"

From Official Kodi Wiki
Jump to: navigation, search
Line 633: Line 633:
 
==type="action"==
 
==type="action"==
 
<syntaxhighlight lang="xml" enclose="div">
 
<syntaxhighlight lang="xml" enclose="div">
<setting type="action" id="test33" label="32033" action="RunScript(script.globalsearch)"/>
+
<setting type="action" id="test33" label="32033" action="RunScript(script.globalsearch)" option="close"/>
 
</syntaxhighlight>
 
</syntaxhighlight>
 
{{hidden|style = width: 60%;|headerstyle = background: #cccccc;|contentstyle = text-align: left; border: 0px solid #AAAAAA;|New Setting Format |<syntaxhighlight lang="xml" enclose="div">
 
{{hidden|style = width: 60%;|headerstyle = background: #cccccc;|contentstyle = text-align: left; border: 0px solid #AAAAAA;|New Setting Format |<syntaxhighlight lang="xml" enclose="div">
Line 642: Line 642:
 
<allowempty>true</allowempty>
 
<allowempty>true</allowempty>
 
</constraints>
 
</constraints>
<control type="button" format="action"/>
+
<control type="button" format="action">
 +
<close>true</close>
 +
</control>
 
</setting>
 
</setting>
 
</syntaxhighlight>}}
 
</syntaxhighlight>}}
Line 648: Line 650:
  
 
<syntaxhighlight lang="xml" enclose="div">
 
<syntaxhighlight lang="xml" enclose="div">
<setting type="action" id="test34" label="32034" action="RunScript(script.globalsearch)" option="close"/>
+
<setting type="action" id="test34" label="32034" action="RunScript(weather.yahoo)" default=""/>
 
</syntaxhighlight>
 
</syntaxhighlight>
 
{{hidden|style = width: 60%;|headerstyle = background: #cccccc;|contentstyle = text-align: left; border: 0px solid #AAAAAA;|New Setting Format |<syntaxhighlight lang="xml" enclose="div">
 
{{hidden|style = width: 60%;|headerstyle = background: #cccccc;|contentstyle = text-align: left; border: 0px solid #AAAAAA;|New Setting Format |<syntaxhighlight lang="xml" enclose="div">
<setting id="test34" type="action" label="32034" help="">
+
<setting id="test34" type="string" label="32034" help="">
 
<level>0</level>
 
<level>0</level>
<data>RunScript(script.globalsearch)</data>
 
 
<constraints>
 
<constraints>
 
<allowempty>true</allowempty>
 
<allowempty>true</allowempty>
 
</constraints>
 
</constraints>
 
<control type="button" format="action">
 
<control type="button" format="action">
<close>true</close>
+
<data>RunScript(weather.yahoo,Location1)</data>
 
</control>
 
</control>
 
</setting>
 
</setting>

Revision as of 01:27, 14 December 2019

1 Converting addon settings

1.1 Preface

As of Kodi 18 Leia it is possible to write your addon settings in the same setting format as Kodi uses. Due to many initial issues, it is not recommended to convert your settings if your addon is in the Leia addon repo.

In Kodi 19 Matrix, those bugs have been fixed, so we recommend to convert your addon setting if you plan to submit your addon to the Matrix addon repo (or higher).

1.2 Structure

The structure of your settings.xml file should look like this

<?xml version="1.0" ?>
<settings version="1">
	<section id="addon">
		<category id="1" label="" help="">
			<group id="1" label="">
				<setting id="" type="" label="" help="">
					<control type="" format=""/>
				</setting>
			</group>
		</category>
	</section>
</settings>
  • your addon settings file can only have one <section> tag. (the use of multiple sections is reserved for kodi's main settings.xml file)
  • you can use multiple <category> tags, just like in the old addon settings format.
  • the <group> tag is a replacement for the old sep and lsep types, you can define multiple groups in order to group a number of settings.

2 Setting types

2.1 type="text"

<setting type="text" id="test01" label="32001" default=""/>


<setting type="text" id="test02" label="32002" default="" option="hidden"/>


<setting type="text" id="test03" label="32003" default="" option="urlencoded"/>


2.2 type="ipaddress"

<setting type="ipaddress" id="test04" label="32004"/>


2.3 type="number"

<setting type="number" id="test05" label="32005"/>


2.4 type="date"

<setting type="date" id="test06" label="32006" default="2015-03-12"/>


2.5 type="time"

<setting type="time" id="test07" label="32007" default="13:13"/>


2.6 type="bool"

<setting type="bool" id="test08" label="32008" default="false"/>


2.7 type="select"

<setting type="select" id="test09" label="32009" lvalues="11|12|13|14"/>


2.8 type="select"

<setting type="select" id="test10" label="32010" values="aa|bb|cc|dd"/>


2.9 type="addon"

<setting type="addon" id="test11" label="32011" default="" addontype="xbmc.metadata.scraper.movies"/>


<setting type="addon" id="test12" label="32012" default="" addontype="xbmc.metadata.scraper.movies" multiselect="true"/>


2.10 type="enum"

<setting type="enum" id="test13" label="32013" lvalues="11|12|13|14"/>


<setting type="enum" id="test14" label="32014" values="aa|bb|cc|dd"/>


2.11 type="labelenum"

<setting type="labelenum" id="test15" label="32015" lvalues="11|12|13|14"/>


<setting type="labelenum" id="test16" label="32016" values="bb|aa|dd|cc" sort="yes"/>


2.12 type="slider"

<setting type="slider" id="test17" label="32017" default="20" range="5,5,100" option="int"/>


<setting type="slider" id="test18" label="32018" default="0.5" range="0.0,0.1,1.0" option="float"/>


<setting type="slider" id="test19" label="32019" default="20" range="0,1,100" option="percent"/>


2.13 type="file"

<setting type="file" id="test20" label="32020" default=""/>


2.14 type="audio"

<setting type="audio" id="test21" label="32021" default=""/>


2.15 type="video"

<setting type="video" id="test22" label="32022" default=""/>


2.16 type="image"

<setting type="image" id="test23" label="32023" default=""/>


2.17 type="executable"

<setting type="executable" id="test24" label="32024" default=""/>


2.18 type="folder"

<setting type="folder" id="test25" label="32025" default=""/>


<setting type="folder" id="test26" label="32026" default="" option="writeable"/>


<setting type="folder" id="test27" label="32027" default="" source="videos"/>


<setting type="folder" id="test28" label="32028" default="" source="music"/>


<setting type="folder" id="test29" label="32029" default="" source="pictures"/>


<setting type="folder" id="test30" label="32030" default="" source="programs"/>


<setting type="folder" id="test31" label="32031" default="" source="files"/>


<setting type="folder" id="test32" label="32032" default="" source="local"/>


2.19 type="action"

<setting type="action" id="test33" label="32033" action="RunScript(script.globalsearch)" option="close"/>


<setting type="action" id="test34" label="32034" action="RunScript(weather.yahoo)" default=""/>


2.20 type="fileenum"

<setting type="fileenum" id="test35" label="32035" values="resources"/>


<setting type="fileenum" id="test36" label="32036" values="resources" mask="/"/>


<setting type="fileenum" id="test37" label="32037" values="resources" mask="*.txt"/>