Service add-ons: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>NedBot
m (Robot: Cosmetic changes)
>NedBot
m (Robot: Changing Category:How To to Category:How-to)
Line 40: Line 40:
You'll find more informations about addons [[Add-ons for XBMC (Developement)|here]]
You'll find more informations about addons [[Add-ons for XBMC (Developement)|here]]


[[Category:How To]]
[[Category:How-to]]

Revision as of 22:34, 11 September 2011

Template:Oudated XBMC has now the possibility to automatically start addons on startup, making the autoexec.py file obselete. These special addons are called service addons.

Service addons must offer the xbmc.service extension point. Here's a typical example of the addon.xml the addon needs to provide:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.tv.betaseries"
       name="BetaSeries.com"
       version="0.1"
       provider-name="blinkseb (XBMC)">
  <requires>
    <import addon="xbmc.python" version="1.0"/>
  </requires>
  <extension point="xbmc.service"
             library="default.py" start="login|startup">
  </extension>
  <extension point="xbmc.addon.metadata">
    <platform>all</platform>
    <summary lang="en">BetaSeries.com integration.</summary>
  </extension>
</addon>

The addon will be automatically started when XBMC starts. You can specify when you want your addon to start, using the start tag. If it's isn't here, your addon will automatically start after user login. If you want it to start on XBMC startup, you need to set the start tag to startup.

Note 1: If your addon is meant to be run while XBMC is running, you need to periodically check if XBMC is exiting. To do that, you need to import the xbmc module, and check if xbmc.abortRequested is true. Typically, you should do something like that:

import xbmc;

while (not xbmc.abortRequested):
  some code

Note 2: services addons are currently limited to python only

Note 3: The addon won't be launched if it's disabled by the user.

You'll find more informations about addons here