11 #include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_epg.h" 12 #include "pvr/settings/PVRSettings.h" 13 #include "threads/CriticalSection.h" 14 #include "threads/Event.h" 15 #include "threads/Thread.h" 16 #include "utils/EventStream.h" 30 class CEpgUpdateRequest;
31 class CEpgTagStateChange;
33 class CPVREpgChannelData;
34 class CPVREpgDatabase;
36 class CPVREpgSearchFilter;
40 struct PVREpgSearchData;
97 bool QueueDeleteEpgs(
const std::vector<std::shared_ptr<CPVREpg>>& epgs);
103 void Notify(
const PVREvent& event);
112 std::shared_ptr<CPVREpg>
CreateChannelEpg(
int iEpgId,
const std::string& strScraperName,
const std::shared_ptr<CPVREpgChannelData>& channelData);
124 std::vector<std::shared_ptr<CPVREpg>>
GetAllEpgs()
const;
131 std::shared_ptr<CPVREpg>
GetById(
int iEpgId)
const;
139 std::shared_ptr<CPVREpg>
GetByChannelUid(
int iClientId,
int iChannelUid)
const;
147 std::shared_ptr<CPVREpgInfoTag>
GetTagById(
const std::shared_ptr<CPVREpg>& epg,
unsigned int iBroadcastId)
const;
226 std::vector<std::shared_ptr<CPVREpgSearchFilter>>
GetSavedSearches(
bool bRadio);
262 bool CheckPlayingEvents();
273 void WaitForUpdateFinish();
281 bool PersistAll(
unsigned int iMaxTimeslice)
const;
287 bool RemoveOldEntries();
294 bool UpdateEPG(
bool bOnlyPending =
false);
300 bool InterruptUpdate()
const;
305 void Process()
override;
310 void LoadFromDatabase();
316 void InsertFromDB(
const std::shared_ptr<CPVREpg>& newEpg);
324 bool QueueDeleteEpg(
const std::shared_ptr<CPVREpg>& epg,
325 const std::shared_ptr<CPVREpgDatabase>& database);
327 std::shared_ptr<CPVREpgDatabase> m_database;
329 bool m_bIsUpdating =
false;
330 std::atomic<bool> m_bIsInitialising = {
332 bool m_bStarted =
false;
333 bool m_bLoaded =
false;
334 bool m_bPreventUpdates =
false;
335 bool m_bPlaying =
false;
336 int m_pendingUpdates = 0;
337 time_t m_iLastEpgCleanup = 0;
338 time_t m_iNextEpgUpdate = 0;
339 time_t m_iNextEpgActiveTagCheck = 0;
340 int m_iNextEpgId = 0;
342 std::map<int, std::shared_ptr<CPVREpg>> m_epgIdToEpgMap;
343 std::map<std::pair<int, int>, std::shared_ptr<CPVREpg>> m_channelUidToEpgMap;
345 mutable CCriticalSection m_critSection;
348 std::list<CEpgUpdateRequest> m_updateRequests;
349 CCriticalSection m_updateRequestsLock;
351 std::list<CEpgTagStateChange> m_epgTagChanges;
352 CCriticalSection m_epgTagChangesLock;
354 bool m_bUpdateNotificationPending =
false;
358 std::atomic<bool> m_bSuspended = {
false};
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
bool UpdateSavedSearchLastExecuted(const CPVREpgSearchFilter &epgSearch)
Update time last executed for the given search.
Definition: EpgContainer.cpp:996
int GetFutureDaysToDisplay() const
Get the number of future days to show in the guide and to import from backends.
Definition: EpgContainer.cpp:908
bool IsStarted() const
Check whether the EpgContainer has fully started.
Definition: EpgContainer.cpp:116
Definition: EpgSearchFilter.h:23
Definition: EpgContainer.h:42
Definition: EpgDatabase.h:31
Definition: ContextMenuManager.h:24
void Unload()
unload all EPG data.
Definition: EpgContainer.cpp:158
void Notify(const PVREvent &event)
CEventStream callback for PVR events.
Definition: EpgContainer.cpp:197
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetTags(const PVREpgSearchData &searchData) const
Get all EPG tags matching the given search criteria.
Definition: EpgContainer.cpp:525
std::shared_ptr< CPVREpgSearchFilter > GetSavedSearchById(bool bRadio, int iId)
Get the saved search matching the given id.
Definition: EpgContainer.cpp:967
bool PersistSavedSearch(CPVREpgSearchFilter &search)
Persist a saved search in the database.
Definition: EpgContainer.cpp:979
void Start()
Start the EPG update thread.
Definition: EpgContainer.cpp:128
std::shared_ptr< CPVREpgDatabase > GetEpgDatabase() const
Get a pointer to the database instance.
Definition: EpgContainer.cpp:106
std::shared_ptr< CPVREpg > CreateChannelEpg(int iEpgId, const std::string &strScraperName, const std::shared_ptr< CPVREpgChannelData > &channelData)
Create the EPg for a given channel.
Definition: EpgContainer.cpp:560
void OnPlaybackStopped()
Inform the epg container that playback of an item was stopped due to user interaction.
Definition: EpgContainer.cpp:919
void SetHasPendingUpdates(bool bHasPendingUpdates=true)
Notify EPG container that there are pending manual EPG updates.
Definition: EpgContainer.cpp:882
void UpdateFromClient(const std::shared_ptr< CPVREpgInfoTag > &tag, EPG_EVENT_STATE eNewState)
A client announced an updated epg tag for a channel.
Definition: EpgContainer.cpp:897
bool QueueDeleteEpgs(const std::vector< std::shared_ptr< CPVREpg >> &epgs)
Queue the deletion of the given EPG tables from this container.
Definition: EpgContainer.cpp:618
void Stop()
Stop the EPG update thread.
Definition: EpgContainer.cpp:143
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
std::shared_ptr< CPVREpgInfoTag > GetTagByDatabaseId(int iDatabaseId) const
Get the EPG event with the given database id.
Definition: EpgContainer.cpp:504
void OnSystemSleep()
Inform the epg container that the system is going to sleep.
Definition: EpgContainer.cpp:925
void UpdateRequest(int iClientID, int iUniqueChannelID)
A client triggered an epg update request for a channel.
Definition: EpgContainer.cpp:891
~CPVREpgContainer() override
Destroy this instance.
Definition: EpgContainer.cpp:100
void OnSystemWake()
Inform the epg container that the system gets awake from sleep.
Definition: EpgContainer.cpp:930
Definition: EpgSearchData.h:20
std::vector< std::shared_ptr< CPVREpgSearchFilter > > GetSavedSearches(bool bRadio)
Get all saved searches from the database.
Definition: EpgContainer.cpp:955
bool DeleteSavedSearch(const CPVREpgSearchFilter &search)
Delete a saved search from the database.
Definition: EpgContainer.cpp:1008
std::pair< CDateTime, CDateTime > GetFirstAndLastEPGDate() const
Get the start and end time across all EPGs.
Definition: EpgContainer.cpp:811
void OnPlaybackStarted()
Inform the epg container that playback of an item just started.
Definition: EpgContainer.cpp:913
std::shared_ptr< CPVREpg > GetById(int iEpgId) const
Get an EPG given its ID.
Definition: EpgContainer.cpp:459
std::shared_ptr< CPVREpg > GetByChannelUid(int iClientId, int iChannelUid) const
Get an EPG given its client id and channel uid.
Definition: EpgContainer.cpp:474
bool Load()
(re)load EPG data.
Definition: EpgContainer.cpp:153
EPG_EVENT_STATE
Definition: pvr_epg.h:601
std::shared_ptr< CPVREpgInfoTag > GetTagById(const std::shared_ptr< CPVREpg > &epg, unsigned int iBroadcastId) const
Get the EPG event with the given event id.
Definition: EpgContainer.cpp:489
int CleanupCachedImages()
Erase stale texture db entries and image files.
Definition: EpgContainer.cpp:935
Definition: PVRSettings.h:27
std::vector< std::shared_ptr< CPVREpg > > GetAllEpgs() const
Get all EPGs.
Definition: EpgContainer.cpp:448
int GetPastDaysToDisplay() const
Get the number of past days to show in the guide and to import from backends.
Definition: EpgContainer.cpp:903