Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
ADDON::CAddonRepos Class Reference

#include <AddonRepos.h>

Public Member Functions

 CAddonRepos ()
 
 CAddonRepos (const std::string &addonId)
 
 CAddonRepos (const std::shared_ptr< IAddon > &repoAddon)
 
void BuildUpdateOrOutdatedList (const std::vector< std::shared_ptr< IAddon > > &installed, std::vector< std::shared_ptr< IAddon > > &result, AddonCheckType addonCheckType) const
 Build the list of addons to be updated depending on defined rules or the list of outdated addons.
 
void BuildAddonsWithUpdateList (const std::vector< std::shared_ptr< IAddon > > &installed, std::map< std::string, AddonWithUpdate > &addonsWithUpdate) const
 Build the list of outdated addons and their available updates.
 
bool DoAddonUpdateCheck (const std::shared_ptr< IAddon > &addon, std::shared_ptr< IAddon > &update) const
 Check if an update is available for a single addon.
 
bool GetLatestAddonVersionFromAllRepos (const std::string &addonId, std::shared_ptr< IAddon > &addon) const
 Retrieves the latest version of an addon from all installed repositories follows addon origin restriction rules.
 
void GetLatestAddonVersions (std::vector< std::shared_ptr< IAddon > > &addonList) const
 Retrieves the latest official versions of addons to vector. Private versions are added obeying updateMode. (either OFFICIAL_ONLY or ANY_REPOSITORY)
 
void GetLatestAddonVersionsFromAllRepos (std::vector< std::shared_ptr< IAddon > > &addonList) const
 Retrieves the latest official versions of addons to vector. Private versions (latest per repository) are added obeying updateMode. (either OFFICIAL_ONLY or ANY_REPOSITORY)
 
bool FindDependency (const std::string &dependsId, const std::string &parentRepoId, std::shared_ptr< IAddon > &dependencyToInstall, std::shared_ptr< CRepository > &repoForDep) const
 Find a dependency to install during an addon install or update If the dependency cannot be found in official versions we look in the installing/updating addon's (the parent's) origin repository.
 
bool FindDependencyByParentRepo (const std::string &dependsId, const std::string &parentRepoId, std::shared_ptr< IAddon > &dependencyToInstall) const
 Find a dependency addon in the repository of its parent.
 
void BuildCompatibleVersionsList (std::vector< std::shared_ptr< IAddon > > &compatibleVersions) const
 Build compatible versions list based on the contents of m_allAddons.
 
bool IsValid () const
 Return whether add-ons repo/version information was properly loaded after construction.
 

Static Public Member Functions

static bool IsFromOfficialRepo (const std::shared_ptr< IAddon > &addon, CheckAddonPath checkAddonPath)
 Checks if the origin-repository of a given addon is defined as official repo and can also verify if the origin-path (e.g. https://mirrors.kodi.tv ...) is matching.
 
static bool IsOfficialRepo (const std::string &repoId)
 Checks if the passed in repository is defined as official repo which includes ORIGIN_SYSTEM.
 

Detailed Description

Class - CAddonRepos Reads information about installed official/third party repos and their contained add-ons from the database. Used to check for updates for installed add-ons and dependencies while obeying permission rules. Note that this class is not responsible for refreshing the repo data stored in the database.

Constructor & Destructor Documentation

◆ CAddonRepos() [1/3]

CAddonRepos::CAddonRepos ( )

◆ CAddonRepos() [2/3]

CAddonRepos::CAddonRepos ( const std::string & addonId)
explicit

◆ CAddonRepos() [3/3]

CAddonRepos::CAddonRepos ( const std::shared_ptr< IAddon > & repoAddon)
explicit

Member Function Documentation

◆ BuildAddonsWithUpdateList()

void CAddonRepos::BuildAddonsWithUpdateList ( const std::vector< std::shared_ptr< IAddon > > & installed,
std::map< std::string, AddonWithUpdate > & addonsWithUpdate ) const

Build the list of outdated addons and their available updates.

Parameters
installedvector of all addons installed on the system that are checked for an update
[out]addonsWithUpdatetarget map

◆ BuildCompatibleVersionsList()

void CAddonRepos::BuildCompatibleVersionsList ( std::vector< std::shared_ptr< IAddon > > & compatibleVersions) const

Build compatible versions list based on the contents of m_allAddons.

Note
content of m_allAddons depends on the preceding call to LoadAddonsFromDatabase()
Parameters
[out]compatibleVersionstarget vector to be filled

◆ BuildUpdateOrOutdatedList()

void CAddonRepos::BuildUpdateOrOutdatedList ( const std::vector< std::shared_ptr< IAddon > > & installed,
std::vector< std::shared_ptr< IAddon > > & result,
AddonCheckType addonCheckType ) const

Build the list of addons to be updated depending on defined rules or the list of outdated addons.

Parameters
installedvector of all addons installed on the system that are checked for an update
[in]addonCheckTypebuild list of OUTDATED or UPDATES
[out]resultlist of addon versions that are going to be installed or are outdated

◆ DoAddonUpdateCheck()

bool CAddonRepos::DoAddonUpdateCheck ( const std::shared_ptr< IAddon > & addon,
std::shared_ptr< IAddon > & update ) const

Check if an update is available for a single addon.

Parameters
addonthat is checked for an update
[out]updatepointer to the found update
Returns
true if an installable update was found, false otherwise

◆ FindDependency()

bool CAddonRepos::FindDependency ( const std::string & dependsId,
const std::string & parentRepoId,
std::shared_ptr< IAddon > & dependencyToInstall,
std::shared_ptr< CRepository > & repoForDep ) const

Find a dependency to install during an addon install or update If the dependency cannot be found in official versions we look in the installing/updating addon's (the parent's) origin repository.

Parameters
dependsIdaddon id of the dependency we're looking for
parentRepoIdorigin repository of the dependee
[out]dependencyToInstallpointer to the found dependency, only use if function returns true
[out]repoForDepthe repository that dependency will install from finally
Returns
true if the dependency was found, false otherwise

◆ FindDependencyByParentRepo()

bool CAddonRepos::FindDependencyByParentRepo ( const std::string & dependsId,
const std::string & parentRepoId,
std::shared_ptr< IAddon > & dependencyToInstall ) const

Find a dependency addon in the repository of its parent.

Parameters
dependsIdaddon id of the dependency we're looking for
parentRepoIdorigin repository of the dependee
[out]dependencyToInstallpointer to the found dependency, only use if function returns true
Returns
true if the dependency was found, false otherwise

◆ GetLatestAddonVersionFromAllRepos()

bool CAddonRepos::GetLatestAddonVersionFromAllRepos ( const std::string & addonId,
std::shared_ptr< IAddon > & addon ) const

Retrieves the latest version of an addon from all installed repositories follows addon origin restriction rules.

Parameters
addonIdaddon id we're looking the latest version for
[out]addonpointer to the found addon
Returns
true if a version was found, false otherwise

◆ GetLatestAddonVersions()

void CAddonRepos::GetLatestAddonVersions ( std::vector< std::shared_ptr< IAddon > > & addonList) const

Retrieves the latest official versions of addons to vector. Private versions are added obeying updateMode. (either OFFICIAL_ONLY or ANY_REPOSITORY)

Parameters
[out]addonListretrieved addon list in a vector

◆ GetLatestAddonVersionsFromAllRepos()

void CAddonRepos::GetLatestAddonVersionsFromAllRepos ( std::vector< std::shared_ptr< IAddon > > & addonList) const

Retrieves the latest official versions of addons to vector. Private versions (latest per repository) are added obeying updateMode. (either OFFICIAL_ONLY or ANY_REPOSITORY)

Parameters
[out]addonListretrieved addon list in a vector

◆ IsFromOfficialRepo()

bool CAddonRepos::IsFromOfficialRepo ( const std::shared_ptr< IAddon > & addon,
CheckAddonPath checkAddonPath )
static

Checks if the origin-repository of a given addon is defined as official repo and can also verify if the origin-path (e.g. https://mirrors.kodi.tv ...) is matching.

Note
if this function is called on locally installed add-ons, for instance when populating 'My add-ons', the local installation path is returned as origin. thus parameter CheckAddonPath::CHOICE_NO needs to be passed in such cases
Parameters
addonpointer to addon to be checked
checkAddonPathalso check origin path
Returns
true if the repository id of a given addon is defined as official and the addons origin matches the defined official origin of the repo id

◆ IsOfficialRepo()

bool CAddonRepos::IsOfficialRepo ( const std::string & repoId)
static

Checks if the passed in repository is defined as official repo which includes ORIGIN_SYSTEM.

Parameters
repoIdrepository id to check
Returns
true if the repository id is defined as official, false otherwise

◆ IsValid()

bool ADDON::CAddonRepos::IsValid ( ) const
inline

Return whether add-ons repo/version information was properly loaded after construction.

Returns
true on success, false otherwise

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