Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
Interface - kodi::addon

Addon type interface functions and classes More...

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.
 

Functions

std::string ATTR_DLL_LOCAL kodi::addon::GetAddonPath (const std::string &append="")
 To get the addon system installation folder.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetLibPath (const std::string &append="")
 This function gives OS associated executable binary path of the addon.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetUserPath (const std::string &append="")
 To get the user-related folder of the addon.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetTempPath (const std::string &append="")
 To get a temporary path for the addon.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetLocalizedString (uint32_t labelId, const std::string &defaultStr="")
 Returns an addon's localized 'unicode string'.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetAddonInfo (const std::string &id)
 Returns the value of an addon property as a string.
 
voidkodi::addon::GetInterface (const std::string &name, const std::string &version)
 Returns a function table to a named interface.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetKodiTypeVersion (int type)
 To get used version inside Kodi itself about asked type.
 
std::string ATTR_DLL_LOCAL kodi::addon::TranslateAddonStatus (ADDON_STATUS status)
 Get to related ADDON_STATUS a human readable text.
 

Detailed Description

Addon type interface functions and classes

Function Documentation

◆ GetAddonInfo()

std::string ATTR_DLL_LOCAL kodi::addon::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");
...

◆ GetAddonPath()

std::string ATTR_DLL_LOCAL kodi::addon::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

◆ GetInterface()

void * kodi::addon::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);
...
const sort_map table[]
Definition SortUtils.cpp:1151

◆ GetKodiTypeVersion()

std::string ATTR_DLL_LOCAL kodi::addon::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.

◆ GetLibPath()

std::string ATTR_DLL_LOCAL kodi::addon::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.

◆ GetLocalizedString()

std::string ATTR_DLL_LOCAL kodi::addon::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");
...

◆ GetTempPath()

std::string ATTR_DLL_LOCAL kodi::addon::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

◆ GetUserPath()

std::string ATTR_DLL_LOCAL kodi::addon::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

◆ TranslateAddonStatus()

std::string ATTR_DLL_LOCAL kodi::addon::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