11 #include "dbwrappers/Database.h" 12 #include "threads/CriticalSection.h" 23 class CPVREpgSearchFilter;
25 struct PVREpgSearchData;
29 static constexpr
int EPG_COMMIT_QUERY_COUNT_LIMIT = 10000;
53 void Close()
override;
104 std::vector<std::shared_ptr<CPVREpg>>
GetAll();
111 std::vector<std::shared_ptr<CPVREpgInfoTag>>
GetAllEpgTags(
int iEpgID);
170 unsigned int iUniqueBroadcastId);
312 std::vector<std::shared_ptr<CPVREpgSearchFilter>>
GetSavedSearches(
bool bRadio);
355 void CreateTables()
override;
360 void CreateAnalytics()
override;
366 void UpdateTables(
int version)
override;
368 int GetMinSchemaVersion()
const override {
return 4; }
370 std::shared_ptr<CPVREpgInfoTag> CreateEpgTag(
const std::unique_ptr<dbiplus::Dataset>& pDS);
372 std::shared_ptr<CPVREpgSearchFilter> CreateEpgSearchFilter(
373 bool bRadio,
const std::unique_ptr<dbiplus::Dataset>& pDS);
375 CCriticalSection m_critSection;
std::shared_ptr< CPVREpgSearchFilter > GetSavedSearchById(bool bRadio, int iId)
Get the saved search matching the given id.
Definition: EpgDatabase.cpp:1357
bool DeleteEpg()
Remove all EPG information from the database.
Definition: EpgDatabase.cpp:329
CPVREpgDatabase()=default
Create a new instance of the EPG database.
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByDatabaseID(int iEpgID, int iDatabaseId)
Get an EPG tag given its EPG id and database ID.
Definition: EpgDatabase.cpp:815
Definition: EpgSearchFilter.h:23
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByMinStartTime(int iEpgID, const CDateTime &minStartTime)
Get the next EPG tag matching the given EPG id and min start time.
Definition: EpgDatabase.cpp:871
~CPVREpgDatabase() override=default
Destroy this instance.
Definition: EpgDatabase.h:31
void Unlock()
Unlock the database.
Definition: EpgDatabase.cpp:47
int Persist(const CPVREpg &epg, bool bQueueWrite)
Persist an EPG table. It's entries are not persisted.
Definition: EpgDatabase.cpp:1139
Definition: ContextMenuManager.h:24
CDateTime GetLastEndTime(int iEpgID)
Get the end time of the last tag in this EPG.
Definition: EpgDatabase.cpp:472
bool Delete(const CPVREpgSearchFilter &epgSearch)
Delete a saved search.
Definition: EpgDatabase.cpp:1472
std::vector< std::string > GetAllIconPaths(int iEpgID)
Get all icon paths for a given EPG id.
Definition: EpgDatabase.cpp:1063
std::vector< std::shared_ptr< CPVREpgSearchFilter > > GetSavedSearches(bool bRadio)
Get all saved searches from the database.
Definition: EpgDatabase.cpp:1331
CDateTime GetMaxEndTime(int iEpgID, const CDateTime &maxEnd)
Get the end time of the first tag with an end time less than the given max time.
Definition: EpgDatabase.cpp:525
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetAllEpgTags(int iEpgID)
Get all tags for a given EPG id.
Definition: EpgDatabase.cpp:1037
bool QueueDeleteTagQuery(const CPVREpgInfoTag &tag)
Write the query to delete the given EPG tag to db query queue.
Definition: EpgDatabase.cpp:364
bool QueueDeleteEpgTags(int iEpgId)
Queue the erase all EPG tags with the given epg ID.
Definition: EpgDatabase.cpp:1190
bool QueueDeleteEpgQuery(const CPVREpg &table)
Queue deletionof an EPG table.
Definition: EpgDatabase.cpp:343
Definition: EpgInfoTag.h:28
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetEpgTagsByMinStartMaxEndTime(int iEpgID, const CDateTime &minStartTime, const CDateTime &maxEndTime)
Get all EPG tags matching the given EPG id, min start time and max end time.
Definition: EpgDatabase.cpp:933
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByStartTime(int iEpgID, const CDateTime &startTime)
Get an EPG tag given its EPG ID and start time.
Definition: EpgDatabase.cpp:841
bool QueueDeleteLastEpgScanTimeQuery(const CPVREpg &table)
Write the query to delete the last scan time for the given EPG to db query queue. ...
Definition: EpgDatabase.cpp:1119
std::vector< std::shared_ptr< CPVREpg > > GetAll()
Get all EPG tables from the database. Does not get the EPG tables' entries.
Definition: EpgDatabase.cpp:380
bool UpdateSavedSearchLastExecuted(const CPVREpgSearchFilter &epgSearch)
Update time last executed for the given search.
Definition: EpgDatabase.cpp:1459
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetEpgTags(const PVREpgSearchData &searchData)
Get all EPG tags matching the given search criteria.
Definition: EpgDatabase.cpp:667
Definition: Database.h:26
std::pair< CDateTime, CDateTime > GetFirstAndLastEPGDate()
Get the start and end time across all EPGs.
Definition: EpgDatabase.cpp:484
bool QueuePersistQuery(const CPVREpgInfoTag &tag)
Write the query to persist the given EPG tag to db query queue.
Definition: EpgDatabase.cpp:1202
bool QueuePersistLastEpgScanTimeQuery(int iEpgId, const CDateTime &lastScanTime)
Write the query to update the last scan time for the given EPG to db query queue. ...
Definition: EpgDatabase.cpp:1110
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByUniqueBroadcastID(int iEpgID, unsigned int iUniqueBroadcastId)
Get an EPG tag given its EPG id and unique broadcast ID.
Definition: EpgDatabase.cpp:788
const char * GetBaseDBName() const override
Get the default sqlite database filename.
Definition: EpgDatabase.h:75
int GetSchemaVersion() const override
Get the minimal database version that is required to operate correctly.
Definition: EpgDatabase.h:69
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
bool GetLastEpgScanTime(int iEpgId, CDateTime *lastScan)
Get the last stored EPG scan time.
Definition: EpgDatabase.cpp:1089
bool Open() override
Open the database.
Definition: EpgDatabase.cpp:30
Definition: EpgSearchData.h:20
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetEpgTagsByMinEndMaxStartTime(int iEpgID, const CDateTime &minEndTime, const CDateTime &maxStartTime)
Get all EPG tags matching the given EPG id, min end time and max start time.
Definition: EpgDatabase.cpp:973
bool HasTags(int iEpgID)
Check whether this EPG has any tags.
Definition: EpgDatabase.cpp:463
int GetLastEPGId()
Definition: EpgDatabase.cpp:1272
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.
Definition: EpgDatabase.cpp:1168
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 d...
Definition: EpgDatabase.cpp:1013
bool DeleteSavedSearches()
Delete all saved searches.
Definition: EpgDatabase.cpp:1488
CDateTime GetMinStartTime(int iEpgID, const CDateTime &minStart)
Get the start time of the first tag with a start time greater than the given min time.
Definition: EpgDatabase.cpp:508
void Close() override
Close the database.
Definition: EpgDatabase.cpp:36
void Lock()
Lock the database.
Definition: EpgDatabase.cpp:42
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByMaxEndTime(int iEpgID, const CDateTime &maxEndTime)
Get the next EPG tag matching the given EPG id and max end time.
Definition: EpgDatabase.cpp:902