Service add-ons

From Official Kodi Wiki
Revision as of 18:10, 31 January 2011 by >Blinkseb
Jump to navigation Jump to search

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">
  </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.

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