Script sources: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
==What XBMC requires for your add-on==
{{mininav|[[Development]]|[[Add-on development]]|[[About Add-ons]]}}
For XBMC to know what to do with your addon, we require your script, and an addon.xml file.  See [[Add-ons_for_XBMC_(Developement)|add-ons for XBMC]] for more information on addon.xml, including how you add descriptions to your addon for users.  A plugin source extends XBMC via the xbmc.python.script extension point. The layout of the XML describing this extension point is as follows:
==What Kodi requires for your add-on==
<section begin="intro" />For Kodi to know what to do with your addon, we require your script, and an addon.xml file. The layout of the XML describing this extension point is as follows:<section end="intro" />


<source lang="xml">
See [[Add-on development|add-ons for Kodi]] for more information on addon.xml, including how you add descriptions to your addon for users. A script extends Kodi via the xbmc.python.script extension point.
 
<syntaxhighlight lang="xml" enclose="div">
   <extension point="xbmc.python.script"
   <extension point="xbmc.python.script"
             library="default.py" />
             library="default.py" />
</source>
</syntaxhighlight>


list of extension points and their explanation:
list of extension points and their explanation:
Line 11: Line 14:
   "xbmc.python.script"          This is the standard Script extension point
   "xbmc.python.script"          This is the standard Script extension point


below listed extensions will not appear in the Scripts/Programs window and can only be run via skin shortcuts
below listed extensions will not appear in the Addons/Programs window and can only be run via skin shortcuts


   "xbmc.python.weather"        Used for weather scripts
   "xbmc.python.weather"        Used for weather scripts
Line 20: Line 23:


Example of "xbmc.python.script":
Example of "xbmc.python.script":
<source lang="xml">
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.rss.editor"
<addon id="script.globalsearch" name="Global Search" version="9.0.5" provider-name="ronie">
      name="RSS Editor"
<requires>
      version="1.5.6"
<import addon="xbmc.python" version="3.0.0"/>
      provider-name="rwparris2">
</requires>
  <requires>
<extension point="xbmc.python.script" library="default.py"/>
    <import addon="xbmc.python" version="1.0"/>
<extension point="xbmc.addon.metadata">
  </requires>
<summary lang="en_GB">Search your library.</summary>
  <extension point="xbmc.python.script"
<description lang="en_GB">This addon can find any item in your video and music library.</description>
            library="default.py" />
<platform>all</platform>
  <extension point="xbmc.addon.metadata">
<license>GPL-2.0-only</license>
    <platform>all</platform>
<forum>https://forum.kodi.tv/showthread.php?tid=109301</forum>
    <minversion>28764</minversion>
<source>https://gitlab.com/ronie/script.globalsearch/</source>
    <summary lang="en">A Script for editing XBMC's built in RSS Ticker</summary>
<assets>
    <description lang="en">A Script for editing XBMC's built in RSS Ticker</description>
<icon>resources/icon.png</icon>
  </extension>
<fanart>resources/fanart.jpg</fanart>
</assets>
<news>- add support for searching musicvideos by artist name</news>
</extension>
</addon>
</addon>
</source>
</syntaxhighlight>
 
== Interacting with Kodi ==
Given that your script can return information to the user, you may wish to allow some (or all) of the information you provide to be translatable. You do this by providing a strings.po file (in resources/language/<name_of_language>/strings.po) which associates integer id's with each label. Kodi then handles loading these string files and ensuring that the users' locale information is taken into account. To display strings you use the '''getString''' function in the Xbmcaddon_module.
 


==Interacting with XBMC==
== See also ==
Given that your script can return information to the user, you may wish to allow some (or all) of the information you provide to be translatable.  You do this by providing a strings.xml file (in resources/language/<name_of_language>/strings.xml) which associates integer id's with each label.  XBMC then handles loading these string files and ensuring that the users' locale information is taken into account.  To display strings you use the '''getString''' function in the [[xbmcaddon module|xbmcaddon module]].
* [[Add-ons]]
* [[Unofficial add-on repositories]]
'''Development:'''
* [[Add-on development]]
* [[Add-on_settings]]
* [[Add-on repositories]]
* [[Official add-on repository]]




[[Category:Add-ons]]
[[Category:Python]]
[[Category:Development]]
[[Category:Add-on development]]

Latest revision as of 23:14, 29 January 2021

Home icon grey.png   ▶ Development ▶ Add-on development ▶ About Add-ons ▶ Script sources

What Kodi requires for your add-on

For Kodi to know what to do with your addon, we require your script, and an addon.xml file. The layout of the XML describing this extension point is as follows:

See add-ons for Kodi for more information on addon.xml, including how you add descriptions to your addon for users. A script extends Kodi via the xbmc.python.script extension point.

  <extension point="xbmc.python.script"
             library="default.py" />

list of extension points and their explanation:

  "xbmc.python.script"          This is the standard Script extension point

below listed extensions will not appear in the Addons/Programs window and can only be run via skin shortcuts

  "xbmc.python.weather"        Used for weather scripts
  "xbmc.python.subtitles"      Used for subtitle scripts
  "xbmc.python.lyrics"         Used for lyrics scripts
  "xbmc.python.library"        Used for skin dependent scripts (e.g. recently added script)


Example of "xbmc.python.script":

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.globalsearch" name="Global Search" version="9.0.5" provider-name="ronie">
	<requires>
		<import addon="xbmc.python" version="3.0.0"/>
	</requires>
	<extension point="xbmc.python.script" library="default.py"/>
	<extension point="xbmc.addon.metadata">
		<summary lang="en_GB">Search your library.</summary>
		<description lang="en_GB">This addon can find any item in your video and music library.</description>
		<platform>all</platform>
		<license>GPL-2.0-only</license>
		<forum>https://forum.kodi.tv/showthread.php?tid=109301</forum>
		<source>https://gitlab.com/ronie/script.globalsearch/</source>
		<assets>
			<icon>resources/icon.png</icon>
			<fanart>resources/fanart.jpg</fanart>
		</assets>
		<news>- add support for searching musicvideos by artist name</news>
	</extension>
</addon>

Interacting with Kodi

Given that your script can return information to the user, you may wish to allow some (or all) of the information you provide to be translatable. You do this by providing a strings.po file (in resources/language/<name_of_language>/strings.po) which associates integer id's with each label. Kodi then handles loading these string files and ensuring that the users' locale information is taken into account. To display strings you use the getString function in the Xbmcaddon_module.


See also

Development: