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

#include <AddonInstaller.h>

Inheritance diagram for ADDON::CAddonInstaller:
IJobCallback

Classes

class  CDownloadJob
 

Public Types

typedef std::map< std::string, CDownloadJobJobMap
 

Public Member Functions

bool IsDownloading () const
 
void GetInstallList (ADDON::VECADDONS &addons) const
 
bool GetProgress (const std::string &addonID, unsigned int &percent, bool &downloadFinshed) const
 
bool Cancel (const std::string &addonID)
 
bool InstallModal (const std::string &addonID, ADDON::AddonPtr &addon, InstallModalPrompt promptForInstall)
 Installs the addon while showing a modal progress dialog.
 
bool InstallOrUpdate (const std::string &addonID, BackgroundJob background, ModalJob modal)
 Install an addon if it is available in a repository.
 
bool InstallOrUpdateDependency (const ADDON::AddonPtr &dependsId, const ADDON::RepositoryPtr &repo)
 Install a dependency from a specific repository.
 
bool RemoveDependency (const std::shared_ptr< IAddon > &dependsId) const
 Remove a single dependency from the system.
 
std::vector< std::string > RemoveOrphanedDepsRecursively () const
 Removes all orphaned add-ons recursively. Removal may orphan further add-ons/dependencies, so loop until no orphaned is left on the system.
 
void InstallAddons (const ADDON::VECADDONS &addons, bool wait, AllowCheckForUpdates allowCheckForUpdates)
 Installs a vector of addons.
 
bool InstallFromZip (const std::string &path)
 Install an addon from the given zip path.
 
bool Install (const std::string &addonId, const ADDON::CAddonVersion &version, const std::string &repoId)
 
bool UnInstall (const ADDON::AddonPtr &addon, bool removeData)
 
bool CheckDependencies (const ADDON::AddonPtr &addon, CAddonDatabase *database=nullptr)
 Check whether dependencies of an addon exist or are installable. Iterates through the addon's dependencies, checking they're installed or installable. Each dependency must also satisfies CheckDependencies in turn.
 
bool CheckDependencies (const ADDON::AddonPtr &addon, std::pair< std::string, std::string > &failedDep, CAddonDatabase *database=nullptr)
 Check whether dependencies of an addon exist or are installable. Iterates through the addon's dependencies, checking they're installed or installable. Each dependency must also satisfies CheckDependencies in turn.
 
bool HasJob (const std::string &ID) const
 Check if an installation job for a given add-on is already queued up.
 
void OnJobComplete (unsigned int jobID, bool success, CJob *job) override
 The callback used when a job completes.
 
void OnJobProgress (unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job) override
 An optional callback function that a job may call while processing.
 
- Public Member Functions inherited from IJobCallback
virtual ~IJobCallback ()=default
 Destructor for job call back objects.
 
virtual void OnJobAbort (unsigned int jobID, CJob *job)
 An optional callback function used when a job will be aborted.
 

Static Public Member Functions

static CAddonInstallerGetInstance ()
 

Member Typedef Documentation

◆ JobMap

typedef std::map<std::string, CDownloadJob> ADDON::CAddonInstaller::JobMap

Member Function Documentation

◆ Cancel()

bool CAddonInstaller::Cancel ( const std::string & addonID)

◆ CheckDependencies() [1/2]

bool CAddonInstaller::CheckDependencies ( const ADDON::AddonPtr & addon,
CAddonDatabase * database = nullptr )

Check whether dependencies of an addon exist or are installable. Iterates through the addon's dependencies, checking they're installed or installable. Each dependency must also satisfies CheckDependencies in turn.

Parameters
addonthe addon to check
databasethe database instance to update. Defaults to NULL.
Returns
true if dependencies are available, false otherwise.

◆ CheckDependencies() [2/2]

bool CAddonInstaller::CheckDependencies ( const ADDON::AddonPtr & addon,
std::pair< std::string, std::string > & failedDep,
CAddonDatabase * database = nullptr )

Check whether dependencies of an addon exist or are installable. Iterates through the addon's dependencies, checking they're installed or installable. Each dependency must also satisfies CheckDependencies in turn.

Parameters
addonthe addon to check
failedDepDependency addon that isn't available
databasethe database instance to update. Defaults to NULL.
Returns
true if dependencies are available, false otherwise.

◆ GetInstallList()

void CAddonInstaller::GetInstallList ( ADDON::VECADDONS & addons) const

◆ GetInstance()

CAddonInstaller & CAddonInstaller::GetInstance ( )
static

◆ GetProgress()

bool CAddonInstaller::GetProgress ( const std::string & addonID,
unsigned int & percent,
bool & downloadFinshed ) const

◆ HasJob()

bool CAddonInstaller::HasJob ( const std::string & ID) const

Check if an installation job for a given add-on is already queued up.

Parameters
IDThe ID of the add-on
Returns
true if a job exists, false otherwise

◆ Install()

bool CAddonInstaller::Install ( const std::string & addonId,
const ADDON::CAddonVersion & version,
const std::string & repoId )

Install an addon with a specific version and repository

◆ InstallAddons()

void CAddonInstaller::InstallAddons ( const ADDON::VECADDONS & addons,
bool wait,
AllowCheckForUpdates allowCheckForUpdates )

Installs a vector of addons.

Parameters
addonsthe list of addons to install
waitif the method should wait for all the DoInstall jobs to finish or if it should return right away
allowCheckForUpdatesindicates if content update checks are allowed after installation of a repository addon from the vector
See also
DoInstall

◆ InstallFromZip()

bool CAddonInstaller::InstallFromZip ( const std::string & path)

Install an addon from the given zip path.

Parameters
paththe zip file to install from
Returns
true if successful, false otherwise
See also
DoInstall
Bug
some zip files return a single item (root folder) that we think is stored, so we don't use the zip:// protocol

◆ InstallModal()

bool CAddonInstaller::InstallModal ( const std::string & addonID,
ADDON::AddonPtr & addon,
InstallModalPrompt promptForInstall )

Installs the addon while showing a modal progress dialog.

Parameters
addonIDthe addon ID of the item to install.
addon[out] the installed addon for later use.
promptForInstallWhether or not to prompt the user before installing the addon.
Returns
true on successful install, false otherwise.
See also
Install

◆ InstallOrUpdate()

bool CAddonInstaller::InstallOrUpdate ( const std::string & addonID,
BackgroundJob background,
ModalJob modal )

Install an addon if it is available in a repository.

Parameters
addonIDthe addon ID of the item to install
backgroundwhether to install in the background or not.
modalwhether to show a modal dialog when not installing in background
Returns
true on successful install, false on failure.
See also
DoInstall

◆ InstallOrUpdateDependency()

bool CAddonInstaller::InstallOrUpdateDependency ( const ADDON::AddonPtr & dependsId,
const ADDON::RepositoryPtr & repo )

Install a dependency from a specific repository.

Parameters
dependsIdthe dependency to install
repothe repository to install the addon from
Returns
true on successful install, false on failure.
See also
DoInstall

◆ IsDownloading()

bool CAddonInstaller::IsDownloading ( ) const

◆ OnJobComplete()

void CAddonInstaller::OnJobComplete ( unsigned int jobID,
bool success,
CJob * job )
overridevirtual

The callback used when a job completes.

OnJobComplete is called at the completion of the job's DoWork() function, and is used to return information to the caller on the result of the job. On returning form this function the CJobManager will destroy this job.

Parameters
jobIDthe unique id of the job (as retrieved from CJobManager::AddJob)
successthe result from the DoWork call
jobthe job that has been processed. The job will be destroyed after this function returns
See also
CJobManager and CJob

Implements IJobCallback.

◆ OnJobProgress()

void CAddonInstaller::OnJobProgress ( unsigned int jobID,
unsigned int progress,
unsigned int total,
const CJob * job )
overridevirtual

An optional callback function that a job may call while processing.

OnJobProgress may be called periodically by a job during it's DoWork() function. It is used by the job to report on progress.

Parameters
jobIDthe unique id of the job (as retrieved from CJobManager::AddJob)
progressthe current progress of the job, out of total.
totalthe total amount of work to be processed.
jobthe job that has been processed.
See also
CJobManager and CJob

Reimplemented from IJobCallback.

◆ RemoveDependency()

bool CAddonInstaller::RemoveDependency ( const std::shared_ptr< IAddon > & dependsId) const

Remove a single dependency from the system.

Parameters
dependsIdthe dependency to remove
Returns
true on successful uninstall, false on failure.

◆ RemoveOrphanedDepsRecursively()

std::vector< std::string > CAddonInstaller::RemoveOrphanedDepsRecursively ( ) const

Removes all orphaned add-ons recursively. Removal may orphan further add-ons/dependencies, so loop until no orphaned is left on the system.

Returns
Names of add-ons that have effectively been removed

◆ UnInstall()

bool CAddonInstaller::UnInstall ( const ADDON::AddonPtr & addon,
bool removeData )

Uninstall an addon, remove addon data if requested


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