Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <EpgDatabase.h>
Public Member Functions | |
CPVREpgDatabase ()=default | |
Create a new instance of the EPG database. | |
~CPVREpgDatabase () override=default | |
Destroy this instance. | |
bool | Open () override |
Open the database. | |
void | Close () override |
Close the database. | |
void | Lock () |
Lock the database. | |
void | Unlock () |
Unlock the database. | |
int | GetSchemaVersion () const override |
Get the minimal database version that is required to operate correctly. | |
const char * | GetBaseDBName () const override |
Get the default sqlite database filename. | |
EPG methods | |
bool | DeleteEpg () |
Remove all EPG information from the database. | |
bool | QueueDeleteEpgQuery (const CPVREpg &table) |
Queue deletionof an EPG table. | |
bool | QueueDeleteTagQuery (const CPVREpgInfoTag &tag) |
Write the query to delete the given EPG tag to db query queue. | |
std::vector< std::shared_ptr< CPVREpg > > | GetAll () |
Get all EPG tables from the database. Does not get the EPG tables' entries. | |
std::vector< std::shared_ptr< CPVREpgInfoTag > > | GetAllEpgTags (int iEpgID) const |
Get all tags for a given EPG id. | |
bool | GetAllIconPaths (int iEpgID, std::vector< std::string > &paths) const |
Get all icon paths for a given EPG id. | |
bool | GetAllParentalRatingIconPaths (int iEpgID, std::vector< std::string > &paths) const |
Get all parental rating icon paths for a given EPG id. | |
bool | HasTags (int iEpgID) const |
Check whether this EPG has any tags. | |
CDateTime | GetLastEndTime (int iEpgID) const |
Get the end time of the last tag in this EPG. | |
std::pair< CDateTime, CDateTime > | GetFirstAndLastEPGDate () const |
Get the start and end time across all EPGs. | |
CDateTime | GetMinStartTime (int iEpgID, const CDateTime &minStart) const |
Get the start time of the first tag with a start time greater than the given min time. | |
CDateTime | GetMaxEndTime (int iEpgID, const CDateTime &maxEnd) const |
Get the end time of the first tag with an end time less than the given max time. | |
std::vector< std::shared_ptr< CPVREpgInfoTag > > | GetEpgTags (const PVREpgSearchData &searchData) const |
Get all EPG tags matching the given search criteria. | |
std::shared_ptr< CPVREpgInfoTag > | GetEpgTagByUniqueBroadcastID (int iEpgID, unsigned int iUniqueBroadcastId) const |
Get an EPG tag given its EPG id and unique broadcast ID. | |
std::shared_ptr< CPVREpgInfoTag > | GetEpgTagByDatabaseID (int iEpgID, int iDatabaseId) const |
Get an EPG tag given its EPG id and database ID. | |
std::shared_ptr< CPVREpgInfoTag > | GetEpgTagByStartTime (int iEpgID, const CDateTime &startTime) const |
Get an EPG tag given its EPG ID and start time. | |
std::shared_ptr< CPVREpgInfoTag > | GetEpgTagByMinStartTime (int iEpgID, const CDateTime &minStartTime) const |
Get the next EPG tag matching the given EPG id and min start time. | |
std::shared_ptr< CPVREpgInfoTag > | GetEpgTagByMaxEndTime (int iEpgID, const CDateTime &maxEndTime) const |
Get the next EPG tag matching the given EPG id and max end time. | |
std::vector< std::shared_ptr< CPVREpgInfoTag > > | GetEpgTagsByMinStartMaxEndTime (int iEpgID, const CDateTime &minStartTime, const CDateTime &maxEndTime) const |
Get all EPG tags matching the given EPG id, min start time and max end time. | |
std::vector< std::shared_ptr< CPVREpgInfoTag > > | GetEpgTagsByMinEndMaxStartTime (int iEpgID, const CDateTime &minEndTime, const CDateTime &maxStartTime) const |
Get all EPG tags matching the given EPG id, min end time and max start time. | |
bool | QueueDeleteEpgTagsByMinEndMaxStartTimeQuery (int iEpgID, const CDateTime &minEndTime, const CDateTime &maxStartTime) |
Write the query to delete all EPG tags in range of given EPG id, min end time and max start time to db query queue. . | |
bool | GetLastEpgScanTime (int iEpgId, CDateTime *lastScan) const |
Get the last stored EPG scan time. | |
bool | QueuePersistLastEpgScanTimeQuery (int iEpgId, const CDateTime &lastScanTime) |
Write the query to update the last scan time for the given EPG to db query queue. | |
bool | QueueDeleteLastEpgScanTimeQuery (const CPVREpg &table) |
Write the query to delete the last scan time for the given EPG to db query queue. | |
int | Persist (const CPVREpg &epg, bool bQueueWrite) |
Persist an EPG table. It's entries are not persisted. | |
bool | DeleteEpgTags (int iEpgId, const CDateTime &maxEndTime) |
Erase all EPG tags with the given epg ID and an end time less than the given time. | |
bool | DeleteEpgTags (int iEpgId) |
Erase all EPG tags with the given epg ID. | |
bool | QueueDeleteEpgTags (int iEpgId) |
Queue the erase all EPG tags with the given epg ID. | |
bool | QueuePersistQuery (const CPVREpgInfoTag &tag) |
Write the query to persist the given EPG tag to db query queue. | |
int | GetLastEPGId () const |
Public Member Functions inherited from CDatabase | |
CDatabase () | |
virtual | ~CDatabase (void) |
bool | IsOpen () |
bool | Compress (bool bForce=true) |
void | Interrupt () |
bool | Open (const DatabaseSettings &db) |
void | BeginTransaction () |
virtual bool | CommitTransaction () |
void | RollbackTransaction () |
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()) const |
Get a single value from a table. | |
std::string | GetSingleValue (const std::string &query) const |
std::string | GetSingleValue (const std::string &query, const std::unique_ptr< dbiplus::Dataset > &ds) const |
Get a single value from a query on a dataset. | |
int | GetSingleValueInt (const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause=std::string(), const std::string &strOrderBy=std::string()) const |
Get a single integer value from a table. | |
int | GetSingleValueInt (const std::string &query) const |
int | GetSingleValueInt (const std::string &query, const std::unique_ptr< dbiplus::Dataset > &ds) const |
Get a single integer value from a query on a dataset. | |
bool | DeleteValues (const std::string &strTable, const Filter &filter=Filter()) |
Delete values from a table. | |
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. | |
bool | ResultQuery (const std::string &strQuery) const |
Execute a query that returns a result. | |
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! | |
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. | |
bool | QueueInsertQuery (const std::string &strQuery) |
Put an INSERT or REPLACE query in the queue. | |
bool | CommitInsertQueries () |
Commit all queries in the queue. | |
size_t | GetInsertQueriesCount () |
Get the number of INSERT queries in the queue. | |
bool | QueueDeleteQuery (const std::string &strQuery) |
Put a DELETE query in the queue. | |
bool | CommitDeleteQueries () |
Commit all queued DELETE queries. | |
size_t | GetDeleteQueriesCount () |
Get the number of DELETE queries in the queue. | |
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) |
EPG searches methods | |
std::vector< std::shared_ptr< CPVREpgSearchFilter > > | GetSavedSearches (bool bRadio) const |
Get all saved searches from the database. | |
std::shared_ptr< CPVREpgSearchFilter > | GetSavedSearchById (bool bRadio, int iId) const |
Get the saved search matching the given id. | |
bool | Persist (CPVREpgSearchFilter &epgSearch) |
Persist a search. | |
bool | UpdateSavedSearchLastExecuted (const CPVREpgSearchFilter &epgSearch) |
Update time last executed for the given search. | |
bool | Delete (const CPVREpgSearchFilter &epgSearch) |
Delete a saved search. | |
bool | DeleteSavedSearches () |
Delete all saved searches. | |
Additional Inherited Members | |
Protected Member Functions inherited from CDatabase | |
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. | |
int | GetDBVersion () |
bool | BuildSQL (const std::string &strQuery, const Filter &filter, std::string &strSQL) const |
Protected Attributes inherited from CDatabase | |
bool | m_sqlite |
whether we use sqlite (defaults to true) | |
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 |
Create a new instance of the EPG database.
|
overridedefault |
Destroy this instance.
bool CPVREpgDatabase::Delete | ( | const CPVREpgSearchFilter & | epgSearch | ) |
Delete a saved search.
epgSearch | The search. |
bool CPVREpgDatabase::DeleteEpg | ( | ) |
Remove all EPG information from the database.
Erase all EPG tags with the given epg ID.
iEpgId | The ID of the EPG. |
Erase all EPG tags with the given epg ID and an end time less than the given time.
iEpgId | The ID of the EPG. |
maxEndTime | The maximum allowed end time. |
bool CPVREpgDatabase::DeleteSavedSearches | ( | ) |
Delete all saved searches.
std::vector< std::shared_ptr< CPVREpg > > CPVREpgDatabase::GetAll | ( | ) |
Get all EPG tables from the database. Does not get the EPG tables' entries.
std::vector< std::shared_ptr< CPVREpgInfoTag > > CPVREpgDatabase::GetAllEpgTags | ( | int | iEpgID | ) | const |
Get all tags for a given EPG id.
iEpgID | The ID of the EPG. |
Get all icon paths for a given EPG id.
iEpgID | The ID of the EPG. |
path | The paths returned. |
bool CPVREpgDatabase::GetAllParentalRatingIconPaths | ( | int | iEpgID, |
std::vector< std::string > & | paths ) const |
Get all parental rating icon paths for a given EPG id.
iEpgID | The ID of the EPG. |
path | The paths returned. |
|
inlineoverridevirtual |
std::shared_ptr< CPVREpgInfoTag > CPVREpgDatabase::GetEpgTagByDatabaseID | ( | int | iEpgID, |
int | iDatabaseId ) const |
Get an EPG tag given its EPG id and database ID.
iEpgID | The ID of the EPG for the tag to get. |
iDatabaseId | The database ID for the tag to get. |
std::shared_ptr< CPVREpgInfoTag > CPVREpgDatabase::GetEpgTagByMaxEndTime | ( | int | iEpgID, |
const CDateTime & | maxEndTime ) const |
Get the next EPG tag matching the given EPG id and max end time.
iEpgID | The ID of the EPG for the tag to get. |
maxEndTime | The max end time for the tag to get. |
std::shared_ptr< CPVREpgInfoTag > CPVREpgDatabase::GetEpgTagByMinStartTime | ( | int | iEpgID, |
const CDateTime & | minStartTime ) const |
Get the next EPG tag matching the given EPG id and min start time.
iEpgID | The ID of the EPG for the tag to get. |
minStartTime | The min start time for the tag to get. |
std::shared_ptr< CPVREpgInfoTag > CPVREpgDatabase::GetEpgTagByStartTime | ( | int | iEpgID, |
const CDateTime & | startTime ) const |
Get an EPG tag given its EPG ID and start time.
iEpgID | The ID of the EPG for the tag to get. |
startTime | The start time for the tag to get. |
std::shared_ptr< CPVREpgInfoTag > CPVREpgDatabase::GetEpgTagByUniqueBroadcastID | ( | int | iEpgID, |
unsigned int | iUniqueBroadcastId ) const |
Get an EPG tag given its EPG id and unique broadcast ID.
iEpgID | The ID of the EPG for the tag to get. |
iUniqueBroadcastId | The unique broadcast ID for the tag to get. |
std::vector< std::shared_ptr< CPVREpgInfoTag > > CPVREpgDatabase::GetEpgTags | ( | const PVREpgSearchData & | searchData | ) | const |
Get all EPG tags matching the given search criteria.
searchData | The search criteria. |
std::vector< std::shared_ptr< CPVREpgInfoTag > > CPVREpgDatabase::GetEpgTagsByMinEndMaxStartTime | ( | int | iEpgID, |
const CDateTime & | minEndTime, | ||
const CDateTime & | maxStartTime ) const |
Get all EPG tags matching the given EPG id, min end time and max start time.
iEpgID | The ID of the EPG for the tags to get. |
minEndTime | The min end time for the tags to get. |
maxStartTime | The max start time for the tags to get. |
std::vector< std::shared_ptr< CPVREpgInfoTag > > CPVREpgDatabase::GetEpgTagsByMinStartMaxEndTime | ( | int | iEpgID, |
const CDateTime & | minStartTime, | ||
const CDateTime & | maxEndTime ) const |
Get all EPG tags matching the given EPG id, min start time and max end time.
iEpgID | The ID of the EPG for the tags to get. |
minStartTime | The min start time for the tags to get. |
maxEndTime | The max end time for the tags to get. |
Get the start and end time across all EPGs.
Get the end time of the last tag in this EPG.
iEpgID | The ID of the EPG. |
int CPVREpgDatabase::GetLastEPGId | ( | ) | const |
Get the last stored EPG scan time.
iEpgId | The table to update the time for. Use 0 for a global value. |
lastScan | The last scan time or -1 if it wasn't found. |
Get the end time of the first tag with an end time less than the given max time.
iEpgID | The ID of the EPG. |
maxEnd | The mx end time. |
Get the start time of the first tag with a start time greater than the given min time.
iEpgID | The ID of the EPG. |
minStart | The min start time. |
std::shared_ptr< CPVREpgSearchFilter > CPVREpgDatabase::GetSavedSearchById | ( | bool | bRadio, |
int | iId ) const |
Get the saved search matching the given id.
bRadio | Whether to fetch a TV or radio saved search. |
iId | The id. |
std::vector< std::shared_ptr< CPVREpgSearchFilter > > CPVREpgDatabase::GetSavedSearches | ( | bool | bRadio | ) | const |
Get all saved searches from the database.
bRadio | Whether to fetch saved searches for radio or TV. |
|
inlineoverridevirtual |
Get the minimal database version that is required to operate correctly.
Implements CDatabase.
Check whether this EPG has any tags.
iEpgID | The ID of the EPG. |
void CPVREpgDatabase::Lock | ( | ) |
Lock the database.
|
overridevirtual |
Open the database.
Reimplemented from CDatabase.
Persist an EPG table. It's entries are not persisted.
epg | The table to persist. |
bQueueWrite | If true, don't execute the query immediately but queue it. |
bool CPVREpgDatabase::Persist | ( | CPVREpgSearchFilter & | epgSearch | ) |
Persist a search.
epgSearch | The search. |
Queue deletionof an EPG table.
tag | The table to queue for deletion. |
Queue the erase all EPG tags with the given epg ID.
iEpgId | The ID of the EPG. |
bool CPVREpgDatabase::QueueDeleteEpgTagsByMinEndMaxStartTimeQuery | ( | int | iEpgID, |
const CDateTime & | minEndTime, | ||
const CDateTime & | maxStartTime ) |
Write the query to delete all EPG tags in range of given EPG id, min end time and max start time to db query queue. .
iEpgID | The ID of the EPG for the tags to delete. |
minEndTime | The min end time for the tags to delete. |
maxStartTime | The max start time for the tags to delete. |
Write the query to delete the last scan time for the given EPG to db query queue.
iEpgId | The table to delete the time for. |
bool CPVREpgDatabase::QueueDeleteTagQuery | ( | const CPVREpgInfoTag & | tag | ) |
Write the query to delete the given EPG tag to db query queue.
tag | The EPG tag to remove. |
bool CPVREpgDatabase::QueuePersistLastEpgScanTimeQuery | ( | int | iEpgId, |
const CDateTime & | lastScanTime ) |
Write the query to update the last scan time for the given EPG to db query queue.
iEpgId | The table to update the time for. |
lastScanTime | The time to write to the database. |
bool CPVREpgDatabase::QueuePersistQuery | ( | const CPVREpgInfoTag & | tag | ) |
Write the query to persist the given EPG tag to db query queue.
tag | The tag to persist. |
void CPVREpgDatabase::Unlock | ( | ) |
Unlock the database.
bool CPVREpgDatabase::UpdateSavedSearchLastExecuted | ( | const CPVREpgSearchFilter & | epgSearch | ) |
Update time last executed for the given search.
epgSearch | The search. |