Kodi Documentation  18.0
Kodi is an open source media player and entertainment hub.
ADDON::CAddonMgr Class Reference

#include <AddonManager.h>

Public Member Functions

bool ReInit ()
 
bool Init ()
 
void DeInit ()
 
 CAddonMgr ()=default
 
 CAddonMgr (const CAddonMgr &)=delete
 
virtual ~CAddonMgr ()
 
CEventStream< AddonEvent > & Events ()
 
CEventStream< AddonEvent > & UnloadEvents ()
 
IAddonMgrCallbackGetCallbackForType (TYPE type)
 
bool RegisterAddonMgrCallback (TYPE type, IAddonMgrCallback *cb)
 
void UnregisterAddonMgrCallback (TYPE type)
 
bool GetAddon (const std::string &id, AddonPtr &addon, const TYPE &type=ADDON_UNKNOWN, bool enabledOnly=true)
 Retrieve a specific addon (of a specific type) More...
 
bool HasType (const std::string &id, const TYPE &type)
 
bool HasAddons (const TYPE &type)
 
bool HasInstalledAddons (const TYPE &type)
 
bool GetAddons (VECADDONS &addons)
 
bool GetAddons (VECADDONS &addons, const TYPE &type)
 
bool GetInstalledAddons (VECADDONS &addons)
 
bool GetInstalledAddons (VECADDONS &addons, const TYPE &type)
 
bool GetDisabledAddons (VECADDONS &addons)
 
bool GetDisabledAddons (VECADDONS &addons, const TYPE &type)
 
bool GetInstallableAddons (VECADDONS &addons)
 
bool GetInstallableAddons (VECADDONS &addons, const TYPE &type)
 
bool GetInstalledBinaryAddons (BINARY_ADDON_LIST &binaryAddonList)
 To get all installed binary addon on Kodi. More...
 
bool GetInstalledBinaryAddon (const std::string &addonId, BINARY_ADDON_LIST_ENTRY &binaryAddon)
 To get requested installed binary addon on Kodi. More...
 
bool FindInstallableById (const std::string &addonId, AddonPtr &addon)
 
void AddToUpdateableAddons (AddonPtr &pAddon)
 
void RemoveFromUpdateableAddons (AddonPtr &pAddon)
 
bool ReloadSettings (const std::string &id)
 
VECADDONS GetAvailableUpdates ()
 
bool HasAvailableUpdates ()
 
std::string GetTranslatedString (const cp_cfg_element_t *root, const char *tag)
 
bool FindAddons ()
 Checks for new / updated add-ons. More...
 
bool UnloadAddon (const std::string &addonId)
 
bool LoadAddon (const std::string &addonId)
 
void OnPostUnInstall (const std::string &id)
 
bool DisableAddon (const std::string &ID)
 Disable an addon. Returns true on success, false on failure. More...
 
bool EnableAddon (const std::string &ID)
 Enable an addon. Returns true on success, false on failure. More...
 
bool IsAddonDisabled (const std::string &ID)
 
bool CanAddonBeDisabled (const std::string &ID)
 
bool CanAddonBeEnabled (const std::string &id)
 
bool IsAddonInstalled (const std::string &ID)
 
bool CanAddonBeInstalled (const AddonPtr &addon)
 
bool CanUninstall (const AddonPtr &addon)
 
bool IsSystemAddon (const std::string &id)
 
bool AddToUpdateBlacklist (const std::string &id)
 
bool RemoveFromUpdateBlacklist (const std::string &id)
 
bool IsBlacklisted (const std::string &id) const
 
void UpdateLastUsed (const std::string &id)
 
std::string GetExtValue (cp_cfg_element_t *base, const char *path) const
 
cp_cfg_element_tGetExtElement (cp_cfg_element_t *base, const char *path)
 Retrieve an element from a given configuration element. More...
 
bool GetExtElements (cp_cfg_element_t *base, const char *path, ELEMENTS &result)
 Retrieve a vector of repeated elements from a given configuration element. More...
 
bool GetExtList (cp_cfg_element_t *base, const char *path, std::vector< std::string > &result) const
 Retrieve a list of strings from a given configuration element Assumes the configuration element or attribute contains a whitespace separated list of values (eg xs:list schema). More...
 
const cp_extension_tGetExtension (const cp_plugin_info_t *props, const char *extension) const
 
std::string GetPlatformLibraryName (cp_cfg_element_t *base) const
 Retrieves the platform-specific library name from the given configuration element. More...
 
bool LoadAddonDescription (const std::string &path, AddonPtr &addon)
 Load the addon in the given path This loads the addon using c-pluff which parses the addon descriptor file. More...
 
bool AddonsFromRepoXML (const CRepository::DirInfo &repo, const std::string &xml, VECADDONS &addons)
 Parse a repository XML file for addons and load their descriptors A repository XML is essentially a concatenated list of addon descriptors. More...
 
bool ServicesHasStarted () const
 
bool IsCompatible (const IAddon &addon)
 
std::vector< DependencyInfoGetDepsRecursive (const std::string &id)
 Recursively get dependencies for an add-on. More...
 

Static Public Member Functions

static AddonPtr AddonFromProps (CAddonInfo &addonInfo)
 
static AddonPtr Factory (const cp_plugin_info_t *plugin, TYPE type)
 
static bool Factory (const cp_plugin_info_t *plugin, TYPE type, CAddonBuilder &builder, bool ignoreExtensions=false, const CRepository::DirInfo &repo={})
 
static void FillCpluffMetadata (const cp_plugin_info_t *plugin, CAddonBuilder &builder, const CRepository::DirInfo &repo)
 

Detailed Description

Class - CAddonMgr Holds references to all addons, enabled or otherwise. Services the generic callbacks available to all addon variants.

Constructor & Destructor Documentation

§ CAddonMgr() [1/2]

ADDON::CAddonMgr::CAddonMgr ( )
default

§ CAddonMgr() [2/2]

ADDON::CAddonMgr::CAddonMgr ( const CAddonMgr )
delete

§ ~CAddonMgr()

ADDON::CAddonMgr::~CAddonMgr ( )
virtual

Member Function Documentation

§ AddonFromProps()

static AddonPtr ADDON::CAddonMgr::AddonFromProps ( CAddonInfo addonInfo)
static

§ AddonsFromRepoXML()

bool ADDON::CAddonMgr::AddonsFromRepoXML ( const CRepository::DirInfo repo,
const std::string &  xml,
VECADDONS addons 
)

Parse a repository XML file for addons and load their descriptors A repository XML is essentially a concatenated list of addon descriptors.

Parameters
repoThe repository info.
xmlThe XML document from repository.
addons[out] returned list of addons.
Returns
true if the repository XML file is parsed, false otherwise.

§ AddToUpdateableAddons()

void ADDON::CAddonMgr::AddToUpdateableAddons ( AddonPtr pAddon)

§ AddToUpdateBlacklist()

bool ADDON::CAddonMgr::AddToUpdateBlacklist ( const std::string &  id)

§ CanAddonBeDisabled()

bool ADDON::CAddonMgr::CanAddonBeDisabled ( const std::string &  ID)

§ CanAddonBeEnabled()

bool ADDON::CAddonMgr::CanAddonBeEnabled ( const std::string &  id)

§ CanAddonBeInstalled()

bool ADDON::CAddonMgr::CanAddonBeInstalled ( const AddonPtr addon)

§ CanUninstall()

bool ADDON::CAddonMgr::CanUninstall ( const AddonPtr addon)

§ DeInit()

void ADDON::CAddonMgr::DeInit ( )

§ DisableAddon()

bool ADDON::CAddonMgr::DisableAddon ( const std::string &  ID)

Disable an addon. Returns true on success, false on failure.

§ EnableAddon()

bool ADDON::CAddonMgr::EnableAddon ( const std::string &  ID)

Enable an addon. Returns true on success, false on failure.

§ Events()

CEventStream<AddonEvent>& ADDON::CAddonMgr::Events ( )
inline

§ Factory() [1/2]

AddonPtr ADDON::CAddonMgr::Factory ( const cp_plugin_info_t plugin,
TYPE  type 
)
static

§ Factory() [2/2]

bool ADDON::CAddonMgr::Factory ( const cp_plugin_info_t plugin,
TYPE  type,
CAddonBuilder builder,
bool  ignoreExtensions = false,
const CRepository::DirInfo repo = {} 
)
static

§ FillCpluffMetadata()

void ADDON::CAddonMgr::FillCpluffMetadata ( const cp_plugin_info_t plugin,
CAddonBuilder builder,
const CRepository::DirInfo repo 
)
static

§ FindAddons()

bool ADDON::CAddonMgr::FindAddons ( )

Checks for new / updated add-ons.

Returns
True if everything went ok, false otherwise

§ FindInstallableById()

bool ADDON::CAddonMgr::FindInstallableById ( const std::string &  addonId,
AddonPtr addon 
)

Get the installable addon with the highest version.

§ GetAddon()

bool ADDON::CAddonMgr::GetAddon ( const std::string &  id,
AddonPtr addon,
const TYPE type = ADDON_UNKNOWN,
bool  enabledOnly = true 
)

Retrieve a specific addon (of a specific type)

Parameters
idthe id of the addon to retrieve.
addon[out] the retrieved addon pointer - only use if the function returns true.
typetype of addon to retrieve - defaults to any type.
enabledOnlywhether we only want enabled addons - set to false to allow both enabled and disabled addons - defaults to true.
Returns
true if an addon matching the id of the given type is available and is enabled (if enabledOnly is true).

§ GetAddons() [1/2]

bool ADDON::CAddonMgr::GetAddons ( VECADDONS addons)

Returns all installed, enabled add-ons.

§ GetAddons() [2/2]

bool ADDON::CAddonMgr::GetAddons ( VECADDONS addons,
const TYPE type 
)

Returns enabled add-ons with given type.

§ GetAvailableUpdates()

VECADDONS ADDON::CAddonMgr::GetAvailableUpdates ( )

Get addons with available updates

§ GetCallbackForType()

IAddonMgrCallback * ADDON::CAddonMgr::GetCallbackForType ( TYPE  type)

§ GetDepsRecursive()

std::vector< DependencyInfo > ADDON::CAddonMgr::GetDepsRecursive ( const std::string &  id)

Recursively get dependencies for an add-on.

§ GetDisabledAddons() [1/2]

bool ADDON::CAddonMgr::GetDisabledAddons ( VECADDONS addons)

§ GetDisabledAddons() [2/2]

bool ADDON::CAddonMgr::GetDisabledAddons ( VECADDONS addons,
const TYPE type 
)

§ GetExtElement()

cp_cfg_element_t * ADDON::CAddonMgr::GetExtElement ( cp_cfg_element_t base,
const char *  path 
)

Retrieve an element from a given configuration element.

Parameters
basethe base configuration element.
paththe path to the configuration element from the base element.
element[out] returned element.
Returns
true if the configuration element is present

§ GetExtElements()

bool ADDON::CAddonMgr::GetExtElements ( cp_cfg_element_t base,
const char *  path,
ELEMENTS result 
)

Retrieve a vector of repeated elements from a given configuration element.

Parameters
basethe base configuration element.
paththe path to the configuration element from the base element.
result[out] returned list of elements.
Returns
true if the configuration element is present and the list of elements is non-empty

§ GetExtension()

const cp_extension_t * ADDON::CAddonMgr::GetExtension ( const cp_plugin_info_t props,
const char *  extension 
) const

§ GetExtList()

bool ADDON::CAddonMgr::GetExtList ( cp_cfg_element_t base,
const char *  path,
std::vector< std::string > &  result 
) const

Retrieve a list of strings from a given configuration element Assumes the configuration element or attribute contains a whitespace separated list of values (eg xs:list schema).

Parameters
basethe base configuration element.
paththe path to the configuration element or attribute from the base element.
result[out] returned list of strings.
Returns
true if the configuration element is present and the list of strings is non-empty

§ GetExtValue()

std::string ADDON::CAddonMgr::GetExtValue ( cp_cfg_element_t base,
const char *  path 
) const

§ GetInstallableAddons() [1/2]

bool ADDON::CAddonMgr::GetInstallableAddons ( VECADDONS addons)

Get all installable addons

§ GetInstallableAddons() [2/2]

bool ADDON::CAddonMgr::GetInstallableAddons ( VECADDONS addons,
const TYPE type 
)

§ GetInstalledAddons() [1/2]

bool ADDON::CAddonMgr::GetInstalledAddons ( VECADDONS addons)

Returns all installed, including disabled.

§ GetInstalledAddons() [2/2]

bool ADDON::CAddonMgr::GetInstalledAddons ( VECADDONS addons,
const TYPE type 
)

Returns installed add-ons, including disabled, with given type.

§ GetInstalledBinaryAddon()

bool ADDON::CAddonMgr::GetInstalledBinaryAddon ( const std::string &  addonId,
BINARY_ADDON_LIST_ENTRY binaryAddon 
)

To get requested installed binary addon on Kodi.

This function is used by ADDON::CBinaryAddonManager to obtain the add-on with the given id, regardless the add-on is disabled or enabled.

Parameters
[in]addonIdId to get
[out]binaryAddonAddon info returned
Returns
True, if the requested add-on was found, false otherwise

§ GetInstalledBinaryAddons()

bool ADDON::CAddonMgr::GetInstalledBinaryAddons ( BINARY_ADDON_LIST binaryAddonList)

To get all installed binary addon on Kodi.

This function becomes used from ADDON::CBinaryAddonManager to get his related addons (whether enabled or disabled).

Parameters
[out]binaryAddonListThe list where from here the binary addons becomes stored.
Returns
If list is not empty becomes true returned

§ GetPlatformLibraryName()

std::string ADDON::CAddonMgr::GetPlatformLibraryName ( cp_cfg_element_t base) const

Retrieves the platform-specific library name from the given configuration element.

§ GetTranslatedString()

std::string ADDON::CAddonMgr::GetTranslatedString ( const cp_cfg_element_t root,
const char *  tag 
)
Bug:
libcpluff isn't const correct

§ HasAddons()

bool ADDON::CAddonMgr::HasAddons ( const TYPE type)

§ HasAvailableUpdates()

bool ADDON::CAddonMgr::HasAvailableUpdates ( )

Returns true if there is any addon with available updates, otherwise false

§ HasInstalledAddons()

bool ADDON::CAddonMgr::HasInstalledAddons ( const TYPE type)

§ HasType()

bool ADDON::CAddonMgr::HasType ( const std::string &  id,
const TYPE type 
)

§ Init()

bool ADDON::CAddonMgr::Init ( )
Todo:
could separate addons into different contexts would allow partial unloading of addon framework

§ IsAddonDisabled()

bool ADDON::CAddonMgr::IsAddonDisabled ( const std::string &  ID)

§ IsAddonInstalled()

bool ADDON::CAddonMgr::IsAddonInstalled ( const std::string &  ID)

§ IsBlacklisted()

bool ADDON::CAddonMgr::IsBlacklisted ( const std::string &  id) const

§ IsCompatible()

bool ADDON::CAddonMgr::IsCompatible ( const IAddon addon)

§ IsSystemAddon()

bool ADDON::CAddonMgr::IsSystemAddon ( const std::string &  id)

§ LoadAddon()

bool ADDON::CAddonMgr::LoadAddon ( const std::string &  addonId)
Note
: should only be called by AddonInstaller

Returns true if the addon was successfully loaded and enabled; otherwise false.

§ LoadAddonDescription()

bool ADDON::CAddonMgr::LoadAddonDescription ( const std::string &  path,
AddonPtr addon 
)

Load the addon in the given path This loads the addon using c-pluff which parses the addon descriptor file.

Parameters
pathfolder that contains the addon.
addon[out] returned addon.
Returns
true if addon is set, false otherwise.

§ OnPostUnInstall()

void ADDON::CAddonMgr::OnPostUnInstall ( const std::string &  id)
Note
: should only be called by AddonInstaller

Hook for clearing internal state after uninstall.

§ RegisterAddonMgrCallback()

bool ADDON::CAddonMgr::RegisterAddonMgrCallback ( TYPE  type,
IAddonMgrCallback cb 
)

§ ReInit()

bool ADDON::CAddonMgr::ReInit ( )
inline

§ ReloadSettings()

bool ADDON::CAddonMgr::ReloadSettings ( const std::string &  id)

§ RemoveFromUpdateableAddons()

void ADDON::CAddonMgr::RemoveFromUpdateableAddons ( AddonPtr pAddon)

§ RemoveFromUpdateBlacklist()

bool ADDON::CAddonMgr::RemoveFromUpdateBlacklist ( const std::string &  id)

§ ServicesHasStarted()

bool ADDON::CAddonMgr::ServicesHasStarted ( ) const

§ UnloadAddon()

bool ADDON::CAddonMgr::UnloadAddon ( const std::string &  addonId)
Note
: should only be called by AddonInstaller

Unload addon from the system. Returns true if it was unloaded, otherwise false.

§ UnloadEvents()

CEventStream<AddonEvent>& ADDON::CAddonMgr::UnloadEvents ( )
inline

§ UnregisterAddonMgrCallback()

void ADDON::CAddonMgr::UnregisterAddonMgrCallback ( TYPE  type)

§ UpdateLastUsed()

void ADDON::CAddonMgr::UpdateLastUsed ( const std::string &  id)

The documentation for this class was generated from the following files: