Service add-ons: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>DonJ
No edit summary
>Martijn
No edit summary
Line 13: Line 13:
   </requires>
   </requires>
   <extension point="xbmc.service"
   <extension point="xbmc.service"
             library="default.py" start="login|startup">
             library="default.py" start="login|start">
   </extension>
   </extension>
   <extension point="xbmc.addon.metadata">
   <extension point="xbmc.addon.metadata">
Line 22: Line 22:
</source>
</source>


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'''.
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 '''start'''.


'''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:
'''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:

Revision as of 18:33, 19 January 2012

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

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