Service add-ons

From Official Kodi Wiki
Revision as of 11:04, 7 September 2011 by Ned Scott (talk | contribs) ({{outdated}}, Category:How To)
Jump to navigation Jump to search

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