![]() |
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
General addon interface functions More...
Topics | |
Definitions, structures and enumerators | |
General definition values | |
Functions | |
void ATTR_DLL_LOCAL | kodi::Log (const ADDON_LOG loglevel, const char *format,...) |
Add a message to Kodi's log. | |
bool ATTR_DLL_LOCAL | kodi::UnknownToUTF8 (const std::string &stringSrc, std::string &utf8StringDst, bool failOnBadChar=false) |
Translate a string with an unknown encoding to UTF8. | |
std::string ATTR_DLL_LOCAL | kodi::GetLanguage (LangFormats format=LANG_FMT_ENGLISH_NAME, bool region=false) |
Returns the active language as a string. | |
void ATTR_DLL_LOCAL | kodi::QueueFormattedNotification (QueueMsg type, const char *format,...) |
Writes the C string pointed by format in the GUI. If format includes format specifiers (subsequences beginning with %), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers. | |
void ATTR_DLL_LOCAL | kodi::QueueNotification (QueueMsg type, const std::string &header, const std::string &message, const std::string &imageFile="", unsigned int displayTime=5000, bool withSound=true, unsigned int messageTime=1000) |
Queue a notification in the GUI. | |
std::string ATTR_DLL_LOCAL | kodi::GetMD5 (const std::string &text) |
Get the MD5 digest of the given text. | |
std::string ATTR_DLL_LOCAL | kodi::GetRegion (const std::string &id) |
Returns your regions setting as a string for the specified id. | |
void ATTR_DLL_LOCAL | kodi::GetFreeMem (long &free, long &total, bool asBytes=false) |
Returns the amount of free memory in MByte (or as bytes) as an long integer. | |
int ATTR_DLL_LOCAL | kodi::GetGlobalIdleTime () |
Returns the elapsed idle time in seconds as an integer. | |
std::string ATTR_DLL_LOCAL | kodi::GetCurrentSkinId () |
Get the currently used skin identification name from Kodi. | |
bool ATTR_DLL_LOCAL | kodi::IsAddonAvailable (const std::string &id, std::string &version, bool &enabled) |
To check another addon is available and usable inside Kodi. | |
void ATTR_DLL_LOCAL | kodi::KodiVersion (kodi_version_t &version) |
Get current Kodi information and versions, returned data from the following kodi_version_t version; kodi::KodiVersion(version); is e.g.: | |
bool ATTR_DLL_LOCAL | kodi::GetKeyboardLayout (int modifierKey, std::string &layout_name, std::vector< std::vector< std::string > > &layout) |
To get keyboard layout characters. | |
bool ATTR_DLL_LOCAL | kodi::ChangeKeyboardLayout (std::string &layout_name) |
To change keyboard layout characters. | |
General addon interface functions
|
inline |
To change keyboard layout characters.
This is used to change the keyboard layout currently used from Kodi
[out] | layout_name | new name of used layout (input string not used!) |
Example:
|
inline |
Get the currently used skin identification name from Kodi.
Example:
|
inline |
Returns the amount of free memory in MByte (or as bytes) as an long integer.
[out] | free | free memory |
[out] | total | total memory |
[in] | asBytes | [opt] if set to true becomes returned as bytes, otherwise as mega bytes |
Example:
|
inline |
Returns the elapsed idle time in seconds as an integer.
Example:
|
inline |
To get keyboard layout characters.
This is used to get the keyboard layout currently used from Kodi by the there set language.
[in] | modifierKey | the key to define the needed layout (uppercase, symbols...) |
[out] | layout_name | name of used layout |
[out] | layout | list of selected keyboard layout |
Example:
|
inline |
Returns the active language as a string.
[in] | format | Used format of the returned language string
| ||||||||
[in] | region | [opt] append the region delimited by "-" of the language (setting) to the returned language string (default is false ) |
Example:
|
inline |
Get the MD5 digest of the given text.
[in] | text | text to compute the MD5 for |
Example:
|
inline |
Returns your regions setting as a string for the specified id.
[in] | id | id of setting to return
|
Example:
|
inline |
To check another addon is available and usable inside Kodi.
[in] | id | The wanted addon identification string to check |
[out] | version | Version string of addon if installed inside Kodi |
[out] | enabled | Set to true true* </b> if addon is enabled / @return Returns <b> true* if addon is installed |
Example: ~~~~~~~~~~~~~{.cpp} #include <kodi/General.h>
bool enabled = false; std::string version; bool ret = kodi::IsAddonAvailable("inputstream.adaptive", version, enabled); fprintf(stderr, "Available inputstream.adaptive version '%s' and enabled '%s'\n", ret ? version.c_str() : "not installed", enabled ? "yes" : "no"); ~~~~~~~~~~~~~
|
inline |
Get current Kodi information and versions, returned data from the following kodi_version_t version; kodi::KodiVersion(version);
is e.g.:
[out] | version | structure to store data from kodi |
Example:
|
inline |
Add a message to Kodi's log.
[in] | loglevel | The log level of the message. |
[in] | format | The format of the message to pass to Kodi. |
[in] | ... | Additional text to insert in format text |
Example:
|
inline |
Writes the C string pointed by format in the GUI. If format includes format specifiers (subsequences beginning with %), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers.
After the format parameter, the function expects at least as many additional arguments as specified by format.
[in] | type | The message type.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
[in] | format | The format of the message to pass to display in Kodi. C string that contains the text to be written to the stream. It can optionally contain embedded format specifiers that are replaced by the values specified in subsequent additional arguments and formatted as requested.
|
The length sub-specifier modifies the length of the data type. This is a chart showing the types used to interpret the corresponding arguments with and without length specifier (if a different type is used, the proper type promotion or conversion is performed, if allowed):
length | d i | u o x X | f F e E g G a A | c | s | p | n |
---|---|---|---|---|---|---|---|
(none) | int | unsigned int | double | int | char* | void* | int* |
hh | signed char | unsigned char | signed char* | ||||
h | short int | unsigned short int | short int* | ||||
l | long int | unsigned long int | wint_t | wchar_t* | long int* | ||
ll | long long int | unsigned long long int | long long int* | ||||
j | intmax_t | uintmax_t | intmax_t* | ||||
z | size_t | size_t | size_t* | ||||
t | ptrdiff_t | ptrdiff_t | ptrdiff_t* | ||||
L | long double |
Note: that the c specifier takes an int (or wint_t) as argument, but performs the proper conversion to a char value (or a wchar_t) before formatting it for output.
[in] | ... | (additional arguments) Depending on the format string, the function may expect a sequence of additional arguments, each containing a value to be used to replace a format specifier in the format string (or a pointer to a storage location, for n). There should be at least as many of these arguments as the number of values specified in the format specifiers. Additional arguments are ignored by the function. |
Example:
|
inline |
Queue a notification in the GUI.
[in] | type | The message type.
| ||||||||||
[in] | header | Header Name (if leaved empty becomes addon name used) | ||||||||||
[in] | message | Message to display on Kodi | ||||||||||
[in] | imageFile | [opt] The image file to show on message (to use must be type set to QUEUE_OWN_STYLE) | ||||||||||
[in] | displayTime | [opt] The time how long message is displayed (default 5 sec) (to use must be type set to QUEUE_OWN_STYLE) | ||||||||||
[in] | withSound | [opt] if true also warning sound becomes played (default with sound) (to use must be type set to QUEUE_OWN_STYLE) | ||||||||||
[in] | messageTime | [opt] how many milli seconds start show of notification (default 1 sec) (to use must be type set to QUEUE_OWN_STYLE) |
Example:
Example:
Example:
|
inline |
Translate a string with an unknown encoding to UTF8.
[in] | stringSrc | The string to translate. |
[out] | utf8StringDst | The translated string. |
[in] | failOnBadChar | [opt] returns failed if bad character is inside (default is false ) |
Example: