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)
const;
125 bool HasTags(
int iEpgID)
const;
161 std::vector<std::shared_ptr<CPVREpgInfoTag>>
GetEpgTags(
171 int iEpgID,
unsigned int iUniqueBroadcastId)
const;
315 std::vector<std::shared_ptr<CPVREpgSearchFilter>>
GetSavedSearches(
bool bRadio)
const;
358 void CreateTables()
override;
363 void CreateAnalytics()
override;
369 void UpdateTables(
int version)
override;
371 int GetMinSchemaVersion()
const override {
return 4; }
373 std::shared_ptr<CPVREpgInfoTag> CreateEpgTag(
374 const std::unique_ptr<dbiplus::Dataset>& pDS)
const;
376 std::shared_ptr<CPVREpgSearchFilter> CreateEpgSearchFilter(
377 bool bRadio,
const std::unique_ptr<dbiplus::Dataset>& pDS)
const;
379 mutable CCriticalSection m_critSection;
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.
Definition: EpgDatabase.cpp:525
bool DeleteEpg()
Remove all EPG information from the database.
Definition: EpgDatabase.cpp:329
CPVREpgDatabase()=default
Create a new instance of the EPG database.
bool HasTags(int iEpgID) const
Check whether this EPG has any tags.
Definition: EpgDatabase.cpp:463
std::vector< std::string > GetAllIconPaths(int iEpgID) const
Get all icon paths for a given EPG id.
Definition: EpgDatabase.cpp:1064
Definition: EpgSearchFilter.h:23
~CPVREpgDatabase() override=default
Destroy this instance.
Definition: EpgDatabase.h:31
void Unlock()
Unlock the database.
Definition: EpgDatabase.cpp:47
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByStartTime(int iEpgID, const CDateTime &startTime) const
Get an EPG tag given its EPG ID and start time.
Definition: EpgDatabase.cpp:842
int Persist(const CPVREpg &epg, bool bQueueWrite)
Persist an EPG table. It's entries are not persisted.
Definition: EpgDatabase.cpp:1140
Definition: ContextMenuManager.h:24
bool GetLastEpgScanTime(int iEpgId, CDateTime *lastScan) const
Get the last stored EPG scan time.
Definition: EpgDatabase.cpp:1090
std::pair< CDateTime, CDateTime > GetFirstAndLastEPGDate() const
Get the start and end time across all EPGs.
Definition: EpgDatabase.cpp:484
bool Delete(const CPVREpgSearchFilter &epgSearch)
Delete a saved search.
Definition: EpgDatabase.cpp:1474
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.
Definition: EpgDatabase.cpp:508
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByUniqueBroadcastID(int iEpgID, unsigned int iUniqueBroadcastId) const
Get an EPG tag given its EPG id and unique broadcast ID.
Definition: EpgDatabase.cpp:788
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.
Definition: EpgDatabase.cpp:974
std::vector< std::shared_ptr< CPVREpgSearchFilter > > GetSavedSearches(bool bRadio) const
Get all saved searches from the database.
Definition: EpgDatabase.cpp:1332
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.
Definition: EpgDatabase.cpp:903
bool QueueDeleteTagQuery(const CPVREpgInfoTag &tag)
Write the query to delete the given EPG tag to db query queue.
Definition: EpgDatabase.cpp:364
std::shared_ptr< CPVREpgSearchFilter > GetSavedSearchById(bool bRadio, int iId) const
Get the saved search matching the given id.
Definition: EpgDatabase.cpp:1359
int GetLastEPGId() const
Definition: EpgDatabase.cpp:1273
bool QueueDeleteEpgTags(int iEpgId)
Queue the erase all EPG tags with the given epg ID.
Definition: EpgDatabase.cpp:1191
CDateTime GetLastEndTime(int iEpgID) const
Get the end time of the last tag in this EPG.
Definition: EpgDatabase.cpp:472
bool QueueDeleteEpgQuery(const CPVREpg &table)
Queue deletionof an EPG table.
Definition: EpgDatabase.cpp:343
Definition: EpgInfoTag.h:28
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:1120
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:1461
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.
Definition: EpgDatabase.cpp:872
Definition: Database.h:26
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.
Definition: EpgDatabase.cpp:934
bool QueuePersistQuery(const CPVREpgInfoTag &tag)
Write the query to persist the given EPG tag to db query queue.
Definition: EpgDatabase.cpp:1203
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:1111
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
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetEpgTags(const PVREpgSearchData &searchData) const
Get all EPG tags matching the given search criteria.
Definition: EpgDatabase.cpp:667
std::shared_ptr< CPVREpgInfoTag > GetEpgTagByDatabaseID(int iEpgID, int iDatabaseId) const
Get an EPG tag given its EPG id and database ID.
Definition: EpgDatabase.cpp:815
bool Open() override
Open the database.
Definition: EpgDatabase.cpp:30
Definition: EpgSearchData.h:20
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:1169
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:1014
bool DeleteSavedSearches()
Delete all saved searches.
Definition: EpgDatabase.cpp:1490
void Close() override
Close the database.
Definition: EpgDatabase.cpp:36
void Lock()
Lock the database.
Definition: EpgDatabase.cpp:42
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetAllEpgTags(int iEpgID) const
Get all tags for a given EPG id.
Definition: EpgDatabase.cpp:1038