Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
PVR::CPVREpg Class Reference

#include <Epg.h>

Public Member Functions

 CPVREpg (int iEpgID, const std::string &strName, const std::string &strScraperName, const std::shared_ptr< CPVREpgDatabase > &database)
 Create a new EPG instance.
 
 CPVREpg (int iEpgID, const std::string &strName, const std::string &strScraperName, const std::shared_ptr< CPVREpgChannelData > &channelData, const std::shared_ptr< CPVREpgDatabase > &database)
 Create a new EPG instance.
 
virtual ~CPVREpg ()
 Destroy this EPG instance.
 
std::shared_ptr< CPVREpgChannelDataGetChannelData () const
 Get data for the channel associated with this EPG.
 
void SetChannelData (const std::shared_ptr< CPVREpgChannelData > &data)
 Set data for the channel associated with this EPG.
 
int ChannelID () const
 The id of the channel associated with this EPG.
 
const std::string & ScraperName () const
 Get the name of the scraper to use for this table.
 
bool UpdatePending () const
 Returns if there is a manual update pending for this EPG.
 
void ForceUpdate ()
 Clear the current tags and schedule manual update.
 
const std::string & Name () const
 Get the name of this table.
 
int EpgID () const
 Get the database ID of this table.
 
void Cleanup (const CDateTime &time)
 Remove all entries from this EPG that finished before the given time.
 
void Clear ()
 Remove all entries from this EPG.
 
std::shared_ptr< CPVREpgInfoTagGetTagNow () const
 Get the event that is occurring now.
 
std::shared_ptr< CPVREpgInfoTagGetTagNext () const
 Get the event that will occur next.
 
std::shared_ptr< CPVREpgInfoTagGetTagPrevious () const
 Get the event that occurred previously.
 
std::shared_ptr< CPVREpgInfoTagGetTagBetween (const CDateTime &beginTime, const CDateTime &endTime, bool bUpdateFromClient=false)
 Get the event that occurs between the given begin and end time.
 
std::shared_ptr< CPVREpgInfoTagGetTagByBroadcastId (unsigned int iUniqueBroadcastId) const
 Get the event matching the given unique broadcast id.
 
std::shared_ptr< CPVREpgInfoTagGetTagByDatabaseId (int iDatabaseId) const
 Get the event matching the given database id.
 
bool UpdateEntry (const EPG_TAG *data, int iClientId)
 Update an entry in this EPG.
 
bool UpdateEntry (const std::shared_ptr< CPVREpgInfoTag > &tag, EPG_EVENT_STATE newState)
 Update an entry in this EPG.
 
bool Update (time_t start, time_t end, int iUpdateTime, int iPastDays, const std::shared_ptr< CPVREpgDatabase > &database, bool bForceUpdate=false)
 Update the EPG from 'start' till 'end'.
 
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetTags () const
 Get all EPG tags.
 
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetTimeline (const CDateTime &timelineStart, const CDateTime &timelineEnd, const CDateTime &minEventEnd, const CDateTime &maxEventStart) const
 Get all EPG tags for the given time frame, including "gap" tags.
 
bool QueuePersistQuery (const std::shared_ptr< CPVREpgDatabase > &database)
 Write the query to persist data into given database's queue.
 
bool QueueDeleteQueries (const std::shared_ptr< CPVREpgDatabase > &database)
 Write the delete queries into the given database's queue.
 
std::pair< CDateTime, CDateTimeGetFirstAndLastUncommitedEPGDate () const
 Get the start and end time of the last not yet commited entry in this table.
 
bool CheckPlayingEvent ()
 Notify observers when the currently active tag changed.
 
bool NeedsSave () const
 Check whether this EPG has unsaved data.
 
bool IsValid () const
 Check whether this EPG is valid.
 
CEventStream< PVREvent > & Events ()
 Query the events available for CEventStream.
 
void Lock ()
 Lock the instance. No other thread gets access to this EPG until Unlock was called.
 
void Unlock ()
 Unlock the instance. Other threads may get access to this EPG again.
 
void RemovedFromContainer ()
 Called to inform the EPG that it has been removed from the EPG container.
 
int CleanupCachedImages (const std::shared_ptr< const CPVREpgDatabase > &database)
 Erase stale texture db entries and image files.
 

Static Public Member Functions

static const std::string & ConvertGenreIdToString (int iID, int iSubID)
 Convert a genre id and subid to a human readable name.
 

Friends

class CPVREpgDatabase
 

Constructor & Destructor Documentation

◆ CPVREpg() [1/2]

CPVREpg::CPVREpg ( int iEpgID,
const std::string & strName,
const std::string & strScraperName,
const std::shared_ptr< CPVREpgDatabase > & database )

Create a new EPG instance.

Parameters
iEpgIDThe ID of this table or <= 0 to create a new ID.
strNameThe name of this table.
strScraperNameThe name of the scraper to use.
databaseThe EPG database

◆ CPVREpg() [2/2]

CPVREpg::CPVREpg ( int iEpgID,
const std::string & strName,
const std::string & strScraperName,
const std::shared_ptr< CPVREpgChannelData > & channelData,
const std::shared_ptr< CPVREpgDatabase > & database )

Create a new EPG instance.

Parameters
iEpgIDThe ID of this table or <= 0 to create a new ID.
strNameThe name of this table.
strScraperNameThe name of the scraper to use.
channelDataThe channel data.
databaseThe EPG database

◆ ~CPVREpg()

CPVREpg::~CPVREpg ( )
virtual

Destroy this EPG instance.

Member Function Documentation

◆ ChannelID()

int CPVREpg::ChannelID ( ) const

The id of the channel associated with this EPG.

Returns
The channel id or -1 if no channel is associated

◆ CheckPlayingEvent()

bool CPVREpg::CheckPlayingEvent ( )

Notify observers when the currently active tag changed.

Returns
True if the playing tag has changed, false otherwise.

◆ Cleanup()

void CPVREpg::Cleanup ( const CDateTime & time)

Remove all entries from this EPG that finished before the given time.

Parameters
timeDelete entries with an end time before this time in UTC.

◆ CleanupCachedImages()

int CPVREpg::CleanupCachedImages ( const std::shared_ptr< const CPVREpgDatabase > & database)

Erase stale texture db entries and image files.

Parameters
databaseThe EPG database
Returns
number of cleaned up images.

◆ Clear()

void CPVREpg::Clear ( )

Remove all entries from this EPG.

◆ ConvertGenreIdToString()

const std::string & CPVREpg::ConvertGenreIdToString ( int iID,
int iSubID )
static

Convert a genre id and subid to a human readable name.

Parameters
iIDThe genre ID.
iSubIDThe genre sub ID.
Returns
A human readable name.

◆ EpgID()

int CPVREpg::EpgID ( ) const

Get the database ID of this table.

Returns
The database ID of this table.

◆ Events()

CEventStream< PVREvent > & PVR::CPVREpg::Events ( )
inline

Query the events available for CEventStream.

◆ ForceUpdate()

void CPVREpg::ForceUpdate ( )

Clear the current tags and schedule manual update.

◆ GetChannelData()

std::shared_ptr< CPVREpgChannelData > CPVREpg::GetChannelData ( ) const

Get data for the channel associated with this EPG.

Returns
The data.

◆ GetFirstAndLastUncommitedEPGDate()

std::pair< CDateTime, CDateTime > CPVREpg::GetFirstAndLastUncommitedEPGDate ( ) const

Get the start and end time of the last not yet commited entry in this table.

Returns
The times; first: start time, second: end time.

◆ GetTagBetween()

std::shared_ptr< CPVREpgInfoTag > CPVREpg::GetTagBetween ( const CDateTime & beginTime,
const CDateTime & endTime,
bool bUpdateFromClient = false )

Get the event that occurs between the given begin and end time.

Parameters
beginTimeMinimum start time in UTC of the event.
endTimeMaximum end time in UTC of the event.
bUpdateFromClientif true, try to fetch the event from the client if not found locally.
Returns
The found tag or NULL if it wasn't found.

◆ GetTagByBroadcastId()

std::shared_ptr< CPVREpgInfoTag > CPVREpg::GetTagByBroadcastId ( unsigned int iUniqueBroadcastId) const

Get the event matching the given unique broadcast id.

Parameters
iUniqueBroadcastIdThe uid to look up
Returns
The matching event or NULL if it wasn't found.

◆ GetTagByDatabaseId()

std::shared_ptr< CPVREpgInfoTag > CPVREpg::GetTagByDatabaseId ( int iDatabaseId) const

Get the event matching the given database id.

Parameters
iDatabaseIdThe id to look up
Returns
The matching event or NULL if it wasn't found.

◆ GetTagNext()

std::shared_ptr< CPVREpgInfoTag > CPVREpg::GetTagNext ( ) const

Get the event that will occur next.

Returns
The next event or NULL if it wasn't found.

◆ GetTagNow()

std::shared_ptr< CPVREpgInfoTag > CPVREpg::GetTagNow ( ) const

Get the event that is occurring now.

Returns
The current event or NULL if it wasn't found.

◆ GetTagPrevious()

std::shared_ptr< CPVREpgInfoTag > CPVREpg::GetTagPrevious ( ) const

Get the event that occurred previously.

Returns
The previous event or NULL if it wasn't found.

◆ GetTags()

std::vector< std::shared_ptr< CPVREpgInfoTag > > CPVREpg::GetTags ( ) const

Get all EPG tags.

Returns
The tags.

◆ GetTimeline()

std::vector< std::shared_ptr< CPVREpgInfoTag > > CPVREpg::GetTimeline ( const CDateTime & timelineStart,
const CDateTime & timelineEnd,
const CDateTime & minEventEnd,
const CDateTime & maxEventStart ) const

Get all EPG tags for the given time frame, including "gap" tags.

Parameters
timelineStartStart of time line
timelineEndEnd of time line
minEventEndThe minimum end time of the events to return
maxEventStartThe maximum start time of the events to return
Returns
The matching tags.

◆ IsValid()

bool CPVREpg::IsValid ( ) const

Check whether this EPG is valid.

Returns
True if this EPG is valid and can be updated, false otherwise.

◆ Lock()

void PVR::CPVREpg::Lock ( )
inline

Lock the instance. No other thread gets access to this EPG until Unlock was called.

◆ Name()

const std::string & CPVREpg::Name ( ) const

Get the name of this table.

Returns
The name of this table.

◆ NeedsSave()

bool CPVREpg::NeedsSave ( ) const

Check whether this EPG has unsaved data.

Returns
True if this EPG contains unsaved data, false otherwise.

◆ QueueDeleteQueries()

bool CPVREpg::QueueDeleteQueries ( const std::shared_ptr< CPVREpgDatabase > & database)

Write the delete queries into the given database's queue.

Parameters
databaseThe database.
Returns
True on success, false otherwise.

◆ QueuePersistQuery()

bool CPVREpg::QueuePersistQuery ( const std::shared_ptr< CPVREpgDatabase > & database)

Write the query to persist data into given database's queue.

Parameters
databaseThe database.
Returns
True on success, false otherwise.

◆ RemovedFromContainer()

void CPVREpg::RemovedFromContainer ( )

Called to inform the EPG that it has been removed from the EPG container.

◆ ScraperName()

const std::string & CPVREpg::ScraperName ( ) const

Get the name of the scraper to use for this table.

Returns
The name of the scraper to use for this table.

◆ SetChannelData()

void CPVREpg::SetChannelData ( const std::shared_ptr< CPVREpgChannelData > & data)

Set data for the channel associated with this EPG.

Parameters
dataThe data.

◆ Unlock()

void PVR::CPVREpg::Unlock ( )
inline

Unlock the instance. Other threads may get access to this EPG again.

◆ Update()

bool CPVREpg::Update ( time_t start,
time_t end,
int iUpdateTime,
int iPastDays,
const std::shared_ptr< CPVREpgDatabase > & database,
bool bForceUpdate = false )

Update the EPG from 'start' till 'end'.

Parameters
startThe start time.
endThe end time.
iUpdateTimeUpdate the table after the given amount of time has passed.
iPastDaysAmount of past days from now on, for which past entries are to be kept.
databaseIf given, the database to store the data.
bForceUpdateForce update from client even if it's not the time to
Returns
True if the update was successful, false otherwise.
Todo
why the channelid check?

◆ UpdateEntry() [1/2]

bool CPVREpg::UpdateEntry ( const EPG_TAG * data,
int iClientId )

Update an entry in this EPG.

Parameters
dataThe tag to update.
iClientIdThe id of the pvr client this event belongs to.
Returns
True if it was updated successfully, false otherwise.

◆ UpdateEntry() [2/2]

bool CPVREpg::UpdateEntry ( const std::shared_ptr< CPVREpgInfoTag > & tag,
EPG_EVENT_STATE newState )

Update an entry in this EPG.

Parameters
tagThe tag to update.
newStatethe new state of the event.
Returns
True if it was updated successfully, false otherwise.

◆ UpdatePending()

bool CPVREpg::UpdatePending ( ) const

Returns if there is a manual update pending for this EPG.

Returns
True if there is a manual update pending, false otherwise

Friends And Related Symbol Documentation

◆ CPVREpgDatabase

friend class CPVREpgDatabase
friend

The documentation for this class was generated from the following files: