![]() |
Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
|
#include <AddonDatabase.h>
Public Member Functions | |
CAddonDatabase () | |
~CAddonDatabase () override | |
bool | Open () override |
bool | GetAddon (const std::string &addonID, ADDON::AddonPtr &addon) |
bool | GetAddon (const std::string &addonID, const ADDON::AddonVersion &version, const std::string &repoId, ADDON::AddonPtr &addon) |
Get an addon with a specific version and repository. More... | |
bool | GetDisabled (std::set< std::string > &addons) |
bool | GetAvailableVersions (const std::string &addonId, std::vector< std::pair< ADDON::AddonVersion, std::string > > &versionsInfo) |
std::pair< ADDON::AddonVersion, std::string > | GetAddonVersion (const std::string &id) |
bool | FindByAddonId (const std::string &addonId, ADDON::VECADDONS &addons) |
bool | UpdateRepositoryContent (const std::string &repositoryId, const ADDON::AddonVersion &version, const std::string &checksum, const std::vector< ADDON::AddonPtr > &addons) |
int | GetRepoChecksum (const std::string &id, std::string &checksum) |
bool | GetRepositoryContent (const std::string &id, ADDON::VECADDONS &addons) |
Get addons in repository id More... | |
bool | GetRepositoryContent (ADDON::VECADDONS &addons) |
int | SetLastChecked (const std::string &id, const ADDON::AddonVersion &version, const std::string ×tamp) |
Set repo last checked date, and create the repo if needed. More... | |
std::pair< CDateTime, ADDON::AddonVersion > | LastChecked (const std::string &id) |
Retrieve the time a repository was last checked and the version it was for. More... | |
bool | Search (const std::string &search, ADDON::VECADDONS &items) |
bool | DisableAddon (const std::string &addonID, bool disable=true) |
Disable an addon. Sets a flag that this addon has been disabled. If disabled, it is usually still available on disk. More... | |
bool | BreakAddon (const std::string &addonID, const std::string &reason="") |
Mark an addon as broken Sets a flag that this addon has been marked as broken in the repository. More... | |
bool | IsAddonBroken (const std::string &addonID) |
Check whether an addon has been marked as broken via BreakAddon. More... | |
bool | BlacklistAddon (const std::string &addonID) |
bool | RemoveAddonFromBlacklist (const std::string &addonID) |
bool | GetBlacklisted (std::set< std::string > &addons) |
bool | AddPackage (const std::string &addonID, const std::string &packageFileName, const std::string &hash) |
Store an addon's package filename and that file's hash for future verification. More... | |
bool | GetPackageHash (const std::string &addonID, const std::string &packageFileName, std::string &hash) |
Query the MD5 checksum of the given given addon's given package. More... | |
bool | RemovePackage (const std::string &packageFileName) |
Remove a package's info from the database. More... | |
void | OnPostUnInstall (const std::string &addonId) |
void | SyncInstalled (const std::set< std::string > &ids, const std::set< std::string > &system, const std::set< std::string > &optional) |
void | GetInstalled (std::vector< ADDON::CAddonBuilder > &addons) |
bool | SetLastUpdated (const std::string &addonId, const CDateTime &dateTime) |
bool | SetOrigin (const std::string &addonId, const std::string &origin) |
bool | SetLastUsed (const std::string &addonId, const CDateTime &dateTime) |
![]() | |
CDatabase () | |
virtual | ~CDatabase (void) |
bool | IsOpen () |
virtual void | Close () |
bool | Compress (bool bForce=true) |
void | Interrupt () |
bool | Open (const DatabaseSettings &db) |
void | BeginTransaction () |
virtual bool | CommitTransaction () |
void | RollbackTransaction () |
bool | InTransaction () |
void | CopyDB (const std::string &latestDb) |
void | DropAnalytics () |
std::string | PrepareSQL (std::string strStmt,...) const |
std::string | GetSingleValue (const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause=std::string(), const std::string &strOrderBy=std::string()) |
Get a single value from a table. More... | |
std::string | GetSingleValue (const std::string &query) |
std::string | GetSingleValue (const std::string &query, std::unique_ptr< dbiplus::Dataset > &ds) |
Get a single value from a query on a dataset. More... | |
bool | DeleteValues (const std::string &strTable, const Filter &filter=Filter()) |
Delete values from a table. More... | |
bool | ExecuteQuery (const std::string &strQuery) |
Execute a query that does not return any result. Note that if BeginMultipleExecute() has been called, the query will be queued until CommitMultipleExecute() is called. More... | |
bool | ResultQuery (const std::string &strQuery) |
Execute a query that returns a result. More... | |
bool | BeginMultipleExecute () |
Start a multiple execution queue. Any ExecuteQuery() function following this call will be queued rather than executed until CommitMultipleExecute() is performed. NOTE: Queries that rely on any queued execute query will not function as expected during this period! More... | |
bool | CommitMultipleExecute () |
Commit the multiple execution queue to the database. Queries are performed within a transaction, and the transaction is rolled back should any one query fail. More... | |
bool | QueueInsertQuery (const std::string &strQuery) |
Put an INSERT or REPLACE query in the queue. More... | |
bool | CommitInsertQueries () |
Commit all queries in the queue. More... | |
virtual bool | GetFilter (CDbUrl &dbUrl, Filter &filter, SortDescription &sorting) |
virtual bool | BuildSQL (const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl) |
virtual bool | BuildSQL (const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl, SortDescription &sorting) |
bool | Connect (const std::string &dbName, const DatabaseSettings &db, bool create) |
Protected Member Functions | |
void | CreateTables () override |
void | CreateAnalytics () override |
void | UpdateTables (int version) override |
int | GetMinSchemaVersion () const override |
int | GetSchemaVersion () const override |
const char * | GetBaseDBName () const override |
bool | GetAddon (int id, ADDON::AddonPtr &addon) |
void | DeleteRepository (const std::string &id) |
![]() | |
void | Split (const std::string &strFileNameAndPath, std::string &strPath, std::string &strFileName) |
bool | CreateDatabase () |
Create database tables and analytics as needed. Calls CreateTables() and CreateAnalytics() on child classes. More... | |
int | GetDBVersion () |
bool | BuildSQL (const std::string &strQuery, const Filter &filter, std::string &strSQL) |
Additional Inherited Members | |
![]() | |
typedef struct CDatabase::DatasetFieldInfo | DatasetFieldInfo |
![]() | |
bool | m_sqlite |
whether we use sqlite (defaults to true) More... | |
std::unique_ptr< dbiplus::Database > | m_pDB |
std::unique_ptr< dbiplus::Dataset > | m_pDS |
std::unique_ptr< dbiplus::Dataset > | m_pDS2 |
const CProfileManager & | m_profileManager |
|
default |
|
overridedefault |
bool CAddonDatabase::AddPackage | ( | const std::string & | addonID, |
const std::string & | packageFileName, | ||
const std::string & | hash | ||
) |
Store an addon's package filename and that file's hash for future verification.
addonID | id of the addon we're adding a package for |
packageFileName | filename of the package |
hash | MD5 checksum of the package |
bool CAddonDatabase::BlacklistAddon | ( | const std::string & | addonID | ) |
bool CAddonDatabase::BreakAddon | ( | const std::string & | addonID, |
const std::string & | reason = "" |
||
) |
Mark an addon as broken Sets a flag that this addon has been marked as broken in the repository.
addonID | id of the addon to mark as broken |
reason | why it is broken - if non empty we take it as broken. Defaults to empty |
|
protected |
bool CAddonDatabase::DisableAddon | ( | const std::string & | addonID, |
bool | disable = true |
||
) |
Disable an addon. Sets a flag that this addon has been disabled. If disabled, it is usually still available on disk.
addonID | id of the addon to disable |
disable | whether to enable or disable. Defaults to true (disable) |
bool CAddonDatabase::FindByAddonId | ( | const std::string & | addonId, |
ADDON::VECADDONS & | addons | ||
) |
Returns all addons in the repositories with id addonId
.
bool CAddonDatabase::GetAddon | ( | const std::string & | addonID, |
ADDON::AddonPtr & | addon | ||
) |
bool CAddonDatabase::GetAddon | ( | const std::string & | addonID, |
const ADDON::AddonVersion & | version, | ||
const std::string & | repoId, | ||
ADDON::AddonPtr & | addon | ||
) |
Get an addon with a specific version and repository.
|
protected |
std::pair< AddonVersion, std::string > CAddonDatabase::GetAddonVersion | ( | const std::string & | id | ) |
bool CAddonDatabase::GetAvailableVersions | ( | const std::string & | addonId, |
std::vector< std::pair< ADDON::AddonVersion, std::string > > & | versionsInfo | ||
) |
|
inlineoverrideprotectedvirtual |
Implements CDatabase.
bool CAddonDatabase::GetBlacklisted | ( | std::set< std::string > & | addons | ) |
bool CAddonDatabase::GetDisabled | ( | std::set< std::string > & | addons | ) |
Get the addon IDs that has been set to disabled
void CAddonDatabase::GetInstalled | ( | std::vector< ADDON::CAddonBuilder > & | addons | ) |
|
overrideprotectedvirtual |
Reimplemented from CDatabase.
bool CAddonDatabase::GetPackageHash | ( | const std::string & | addonID, |
const std::string & | packageFileName, | ||
std::string & | hash | ||
) |
Query the MD5 checksum of the given given addon's given package.
addonID | id of the addon we're who's package we're querying |
packageFileName | filename of the package |
hash | return the MD5 checksum of the package |
int CAddonDatabase::GetRepoChecksum | ( | const std::string & | id, |
std::string & | checksum | ||
) |
bool CAddonDatabase::GetRepositoryContent | ( | ADDON::VECADDONS & | addons | ) |
Get addons across all repositories
bool CAddonDatabase::GetRepositoryContent | ( | const std::string & | id, |
ADDON::VECADDONS & | addons | ||
) |
Get addons in repository id
id | id of the repository |
bool CAddonDatabase::IsAddonBroken | ( | const std::string & | addonID | ) |
Check whether an addon has been marked as broken via BreakAddon.
addonID | id of the addon to check |
std::pair< CDateTime, ADDON::AddonVersion > CAddonDatabase::LastChecked | ( | const std::string & | id | ) |
Retrieve the time a repository was last checked and the version it was for.
id | id of the repo |
void CAddonDatabase::OnPostUnInstall | ( | const std::string & | addonId | ) |
Clear internal fields that shouldn't be kept around indefinitely
|
overridevirtual |
Reimplemented from CDatabase.
bool CAddonDatabase::RemoveAddonFromBlacklist | ( | const std::string & | addonID | ) |
bool CAddonDatabase::RemovePackage | ( | const std::string & | packageFileName | ) |
Remove a package's info from the database.
packageFileName | filename of the package |
bool CAddonDatabase::Search | ( | const std::string & | search, |
ADDON::VECADDONS & | items | ||
) |
int CAddonDatabase::SetLastChecked | ( | const std::string & | id, |
const ADDON::AddonVersion & | version, | ||
const std::string & | timestamp | ||
) |
Set repo last checked date, and create the repo if needed.
id | id of the repository |
bool CAddonDatabase::SetLastUpdated | ( | const std::string & | addonId, |
const CDateTime & | dateTime | ||
) |
bool CAddonDatabase::SetLastUsed | ( | const std::string & | addonId, |
const CDateTime & | dateTime | ||
) |
bool CAddonDatabase::SetOrigin | ( | const std::string & | addonId, |
const std::string & | origin | ||
) |
void CAddonDatabase::SyncInstalled | ( | const std::set< std::string > & | ids, |
const std::set< std::string > & | system, | ||
const std::set< std::string > & | optional | ||
) |
bool CAddonDatabase::UpdateRepositoryContent | ( | const std::string & | repositoryId, |
const ADDON::AddonVersion & | version, | ||
const std::string & | checksum, | ||
const std::vector< ADDON::AddonPtr > & | addons | ||
) |
|
overrideprotectedvirtual |
remove all add-ons because the previous upgrade created dupes in it's first version
Reimplemented from CDatabase.