Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
CAddonInstaller Class Reference

#include <AddonInstaller.h>

Inheritance diagram for 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, bool promptForInstall=true)
 Installs the addon while showing a modal progress dialog. More...
 
bool InstallOrUpdate (const std::string &addonID, bool background=true, bool modal=false)
 Install an addon if it is available in a repository. More...
 
bool InstallFromZip (const std::string &path)
 Install an addon from the given zip path. More...
 
void Install (const std::string &addonId, const ADDON::AddonVersion &version, const std::string &repoId)
 
bool CheckDependencies (const ADDON::AddonPtr &addon, CAddonDatabase *database=NULL)
 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. More...
 
bool CheckDependencies (const ADDON::AddonPtr &addon, std::pair< std::string, std::string > &failedDep, CAddonDatabase *database=NULL)
 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. More...
 
bool HasJob (const std::string &ID) const
 Check if an installation job for a given add-on is already queued up. More...
 
void InstallUpdatesAndWait ()
 
void InstallUpdates ()
 
void OnJobComplete (unsigned int jobID, bool success, CJob *job) override
 The callback used when a job completes. More...
 
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. More...
 
- Public Member Functions inherited from IJobCallback
virtual ~IJobCallback ()=default
 Destructor for job call back objects. More...
 

Static Public Member Functions

static CAddonInstallerGetInstance ()
 

Member Typedef Documentation

◆ JobMap

typedef std::map<std::string, CDownloadJob> 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 = NULL 
)

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 = NULL 
)

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()

void CAddonInstaller::Install ( const std::string &  addonId,
const ADDON::AddonVersion version,
const std::string &  repoId 
)

Install an addon with a specific version and repository

◆ 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,
bool  promptForInstall = true 
)

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,
bool  background = true,
bool  modal = false 
)

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. Defaults to true.
modalwhether to show a modal dialog when not installing in background
Returns
true on successful install, false on failure.
See also
DoInstall

◆ InstallUpdates()

void CAddonInstaller::InstallUpdates ( )

◆ InstallUpdatesAndWait()

void CAddonInstaller::InstallUpdatesAndWait ( )

Install update and block until all updates have installed.

◆ 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.


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