Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Interface - kodi::addon

Detailed Description

Addon type interface functions and classes

Topics

 class CAddonBase
 Add-on main instance class
This is the addon main class, similar to an int main() in executable and carries out initial work and later management of it.
 
 Addon type instances
 Group of possible processing instances which can be made available by an add-on
Kodi enables numerous different ways in which the necessary documentation is included in this group.
 
 1. Setting control
 Functions to handle settings access
This can be used to get and set the addon related values inside his settings.xml.
 

Function Documentation

◆ GetAddonPath()

std::string ATTR_DLL_LOCAL GetAddonPath ( const std::string & append = "")
inline

To get the addon system installation folder.

Parameters
[in]append[optional] Path to append to given string
Returns
Path where addon is installed

◆ GetLibPath()

std::string ATTR_DLL_LOCAL GetLibPath ( const std::string & append = "")
inline

This function gives OS associated executable binary path of the addon.

With some systems this can differ from the addon path at GetAddonPath.

As an example on Linux:

  • Addon path is at /usr/share/kodi/addons/YOUR_ADDON_ID
  • Library path is at /usr/lib/kodi/addons/YOUR_ADDON_ID
Note
In addition, in this function, for a given folder, the add-on path itself, but its parent.
Returns
Kodi's system library path where related addons are installed.

◆ GetUserPath()

std::string ATTR_DLL_LOCAL GetUserPath ( const std::string & append = "")
inline

To get the user-related folder of the addon.

Note
This folder is not created automatically and has to be created by the addon the first time.
Parameters
[in]append[optional] Path to append to given string
Returns
User path of addon

◆ GetTempPath()

std::string ATTR_DLL_LOCAL GetTempPath ( const std::string & append = "")
inline

To get a temporary path for the addon.

This gives a temporary path which the addon can use individually for its things.

The content of this folder will be deleted when Kodi is finished!

Parameters
[in]appendA string to append to returned temporary path
Returns
Individual path for the addon

◆ GetLocalizedString()

std::string ATTR_DLL_LOCAL GetLocalizedString ( uint32_t labelId,
const std::string & defaultStr = "" )
inline

Returns an addon's localized 'unicode string'.

Parameters
[in]labelIdstring you want to localize
[in]defaultStr[opt] The default message, also helps to identify the code that is used (default is empty)
Returns
The localized message, or default if the add-on helper fails to return a message
Note
Label id's 30000 to 30999 and 32000 to 32999 are related to the add-on's own included strings from ./resources/language/resource.language.??_??/strings.po All other strings are from Kodi core language files.

Example:

#include <kodi/General.h>
...
std::string str = kodi::GetLocalizedString(30005, "Use me as default");
...

◆ GetAddonInfo()

std::string ATTR_DLL_LOCAL GetAddonInfo ( const std::string & id)
inline

Returns the value of an addon property as a string.

Parameters
[in]idid of the property that the module needs to access
Choices are
author icon stars
changelog id summary
description name type
disclaimer path version
fanart profile
Returns
AddOn property as a string

Example:

#include <kodi/General.h>
...
std::string addonName = kodi::GetAddonInfo("name");
...
Definition PeripheralUtils.h:48

◆ GetInterface()

void * GetInterface ( const std::string & name,
const std::string & version )
inline

Returns a function table to a named interface.

Returns
pointer to struct containing interface functions

Example:

#include <kodi/General.h>
#include <kodi/platform/foo.h>
...
FuncTable_foo *table = kodi::GetPlatformInfo(foo_name, foo_version);
...

◆ GetKodiTypeVersion()

std::string ATTR_DLL_LOCAL GetKodiTypeVersion ( int type)
inline

To get used version inside Kodi itself about asked type.

This thought to allow a addon a handling of newer addon versions within older Kodi until the type min version not changed.

Parameters
[in]typeThe wanted type of ADDON_TYPE to ask
Returns
The version string about type in MAJOR.MINOR.PATCH style.

◆ TranslateAddonStatus()

std::string ATTR_DLL_LOCAL TranslateAddonStatus ( ADDON_STATUS status)
inline

Get to related ADDON_STATUS a human readable text.

Parameters
[in]statusStatus value to get name for
Returns
Wanted name, as "Unknown" if status not known