Archive:Script library: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==What Kodi requires for your addon==
==What Kodi requires for your addon==
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)|here]] 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.library extension point. The layout of the XML describing this extension point is as follows:
For XBMC to know what to do with your addon, we require your script, and an addon.xml file. See [[Add-on development|here]] 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.library extension point. The layout of the XML describing this extension point is as follows:


<syntaxhighlight lang="xml" enclose="div">
<syntaxhighlight lang="xml" enclose="div">

Revision as of 06:39, 11 July 2020

What Kodi requires for your addon

For XBMC to know what to do with your addon, we require your script, and an addon.xml file. See here 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.library extension point. The layout of the XML describing this extension point is as follows:

  <extension point="xbmc.python.library"
             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 Scripts/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.library":

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.recentlyadded"
       name="Recently Added script"
       version="1.0.4"
       provider-name="Nuka1195">
  <requires>
    <import addon="xbmc.python" version="1.0"/>
  </requires>
  <extension point="xbmc.python.library"
             library="default.py" />
  <extension point="xbmc.addon.metadata">
    <platform>all</platform>
    <minversion>28764</minversion>
    <summary>Recently Added script</summary>
    <description>Recently Added script</description>
  </extension>
</addon>

Interacting with XBMC

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 getLocalizedString function in the xbmcaddon module.