Kodi Documentation
Kodi is an open source media player and entertainment hub.
Library - xbmcaddon

Kodi's addon class. More...

Collaboration diagram for Library - xbmcaddon:

Modules

 Settings
 Add-on settings
 

Classes

class  XBMCAddon::xbmcaddon::Addon
 

Functions

 XBMCAddon::xbmcaddon::Addon::getLocalizedString (...)
 { xbmcaddon.Addon([id]).getLocalizedString(id) } Returns an addon's localized 'string'. More...
 
 XBMCAddon::xbmcaddon::Addon::getSettings (...)
 { xbmcaddon.Addon([id]).getSettings() } Returns a wrapper around the addon's settings. More...
 
 XBMCAddon::xbmcaddon::Addon::getSetting (...)
 { xbmcaddon.Addon([id]).getSetting(id) } Returns the value of a setting as string. More...
 
 XBMCAddon::xbmcaddon::Addon::getSettingBool (...)
 { xbmcaddon.Addon([id]).getSettingBool(id) } Returns the value of a setting as a boolean. More...
 
 XBMCAddon::xbmcaddon::Addon::getSettingInt (...)
 { xbmcaddon.Addon([id]).getSettingInt(id) } Returns the value of a setting as an integer. More...
 
 XBMCAddon::xbmcaddon::Addon::getSettingNumber (...)
 { xbmcaddon.Addon([id]).getSettingNumber(id) } Returns the value of a setting as a floating point number. More...
 
 XBMCAddon::xbmcaddon::Addon::getSettingString (...)
 { xbmcaddon.Addon([id]).getSettingString(id) } Returns the value of a setting as a string. More...
 
 XBMCAddon::xbmcaddon::Addon::setSetting (...)
 { xbmcaddon.Addon([id]).setSetting(id, value) } Sets a script setting. More...
 
 XBMCAddon::xbmcaddon::Addon::setSettingBool (...)
 { xbmcaddon.Addon([id]).setSettingBool(id, value) } Sets a script setting. More...
 
 XBMCAddon::xbmcaddon::Addon::setSettingInt (...)
 { xbmcaddon.Addon([id]).setSettingInt(id, value) } Sets a script setting. More...
 
 XBMCAddon::xbmcaddon::Addon::setSettingNumber (...)
 { xbmcaddon.Addon([id]).setSettingNumber(id, value) } Sets a script setting. More...
 
 XBMCAddon::xbmcaddon::Addon::setSettingString (...)
 { xbmcaddon.Addon([id]).setSettingString(id, value) } Sets a script setting. More...
 
 XBMCAddon::xbmcaddon::Addon::openSettings ()
 { xbmcaddon.Addon([id]).openSettings() } Opens this scripts settings dialog. More...
 
 XBMCAddon::xbmcaddon::Addon::getAddonInfo (...)
 { xbmcaddon.Addon([id]).getAddonInfo(id) } Returns the value of an addon property as a string. More...
 

Detailed Description

Kodi's addon class.

Offers classes and functions that manipulate the add-on settings, information and localization.


{ xbmcaddon.Addon([id]) }

Creates a new AddOn class.

Parameters
id[opt] string - id of the addon as specified in addon.xml
Note
Specifying the addon id is not needed.
Important however is that the addon folder has the same name as the AddOn id provided in addon.xml.
You can optionally specify the addon id from another installed addon to retrieve settings from it.

id is optional as it will be auto detected for this add-on instance.

Example:

..
self.Addon = xbmcaddon.Addon()
self.Addon = xbmcaddon.Addon('script.foo.bar')
..

Function Documentation

◆ getAddonInfo()

String XBMCAddon::xbmcaddon::Addon::getAddonInfo (   ...)

{ xbmcaddon.Addon([id]).getAddonInfo(id) } Returns the value of an addon property as a string.

Parameters
idstring - id of the property that the module needs to access.
Choices for the property are
author changelog description disclaimer
fanart icon id name
path profile stars summary
type version
Returns
AddOn property as a string

Example:

..
version = self.Addon.getAddonInfo('version')
..

◆ getLocalizedString()

String XBMCAddon::xbmcaddon::Addon::getLocalizedString (   ...)

{ xbmcaddon.Addon([id]).getLocalizedString(id) } Returns an addon's localized 'string'.

Parameters
idinteger - id# for string you want to localize.
Returns
Localized 'string'

id is optional as it will be auto detected for this add-on instance.

Example:

..
locstr = self.Addon.getLocalizedString(32000)
..

◆ getSetting()

String XBMCAddon::xbmcaddon::Addon::getSetting (   ...)

{ xbmcaddon.Addon([id]).getSetting(id) } Returns the value of a setting as string.

Parameters
idstring - id of the setting that the module needs to access.
Returns
Setting as a string

id is optional as it will be auto detected for this add-on instance.

Example:

..
apikey = self.Addon.getSetting('apikey')
..

◆ getSettingBool()

bool XBMCAddon::xbmcaddon::Addon::getSettingBool (   ...)

{ xbmcaddon.Addon([id]).getSettingBool(id) } Returns the value of a setting as a boolean.

Parameters
idstring - id of the setting that the module needs to access.
Returns
Setting as a boolean

New function added. Deprecated. Use Settings.getBool() instead.

Example:

..
enabled = self.Addon.getSettingBool('enabled')
..

◆ getSettingInt()

int XBMCAddon::xbmcaddon::Addon::getSettingInt (   ...)

{ xbmcaddon.Addon([id]).getSettingInt(id) } Returns the value of a setting as an integer.

Parameters
idstring - id of the setting that the module needs to access.
Returns
Setting as an integer

New function added. Deprecated. Use Settings.getInt() instead.

Example:

..
max = self.Addon.getSettingInt('max')
..

◆ getSettingNumber()

double XBMCAddon::xbmcaddon::Addon::getSettingNumber (   ...)

{ xbmcaddon.Addon([id]).getSettingNumber(id) } Returns the value of a setting as a floating point number.

Parameters
idstring - id of the setting that the module needs to access.
Returns
Setting as a floating point number

New function added. Deprecated. Use Settings.getNumber() instead.

Example:

..
max = self.Addon.getSettingNumber('max')
..

◆ getSettings()

Settings * XBMCAddon::xbmcaddon::Addon::getSettings (   ...)

{ xbmcaddon.Addon([id]).getSettings() } Returns a wrapper around the addon's settings.

Returns
Settings wrapper

New function added.

Example:

..
settings = self.Addon.getSettings()
..

◆ getSettingString()

String XBMCAddon::xbmcaddon::Addon::getSettingString (   ...)

{ xbmcaddon.Addon([id]).getSettingString(id) } Returns the value of a setting as a string.

Parameters
idstring - id of the setting that the module needs to access.
Returns
Setting as a string

New function added. Deprecated. Use Settings.getString() instead.

Example:

..
apikey = self.Addon.getSettingString('apikey')
..

◆ openSettings()

void XBMCAddon::xbmcaddon::Addon::openSettings ( )

{ xbmcaddon.Addon([id]).openSettings() } Opens this scripts settings dialog.


Example:

..
self.Addon.openSettings()
..

◆ setSetting()

void XBMCAddon::xbmcaddon::Addon::setSetting (   ...)

{ xbmcaddon.Addon([id]).setSetting(id, value) } Sets a script setting.

Parameters
idstring - id of the setting that the module needs to access.
valuestring - value of the setting.
Note
You can use the above as keywords for arguments.

id is optional as it will be auto detected for this add-on instance.

Example:

..
self.Addon.setSetting(id='username', value='teamkodi')
..

◆ setSettingBool()

bool XBMCAddon::xbmcaddon::Addon::setSettingBool (   ...)

{ xbmcaddon.Addon([id]).setSettingBool(id, value) } Sets a script setting.

Parameters
idstring - id of the setting that the module needs to access.
valueboolean - value of the setting.
Returns
True if the value of the setting was set, false otherwise
Note
You can use the above as keywords for arguments.

New function added. Deprecated. Use Settings.setBool() instead.

Example:

..
self.Addon.setSettingBool(id='enabled', value=True)
..

◆ setSettingInt()

bool XBMCAddon::xbmcaddon::Addon::setSettingInt (   ...)

{ xbmcaddon.Addon([id]).setSettingInt(id, value) } Sets a script setting.

Parameters
idstring - id of the setting that the module needs to access.
valueinteger - value of the setting.
Returns
True if the value of the setting was set, false otherwise
Note
You can use the above as keywords for arguments.

New function added. Deprecated. Use Settings.setInt() instead.

Example:

..
self.Addon.setSettingInt(id='max', value=5)
..

◆ setSettingNumber()

bool XBMCAddon::xbmcaddon::Addon::setSettingNumber (   ...)

{ xbmcaddon.Addon([id]).setSettingNumber(id, value) } Sets a script setting.

Parameters
idstring - id of the setting that the module needs to access.
valuefloat - value of the setting.
Returns
True if the value of the setting was set, false otherwise
Note
You can use the above as keywords for arguments.

New function added. Deprecated. Use Settings.setNumber() instead.

Example:

..
self.Addon.setSettingNumber(id='max', value=5.5)
..

◆ setSettingString()

bool XBMCAddon::xbmcaddon::Addon::setSettingString (   ...)

{ xbmcaddon.Addon([id]).setSettingString(id, value) } Sets a script setting.

Parameters
idstring - id of the setting that the module needs to access.
valuestring or unicode - value of the setting.
Returns
True if the value of the setting was set, false otherwise
Note
You can use the above as keywords for arguments.

New function added. Deprecated. Use Settings.setString() instead.

Example:

..
self.Addon.setSettingString(id='username', value='teamkodi')
..