Kodi Documentation  18.0
Kodi is an open source media player and entertainment hub.
PVR::CPVREpg Class Reference

#include <Epg.h>

Inheritance diagram for PVR::CPVREpg:
Observable

Public Member Functions

 CPVREpg (int iEpgID, const std::string &strName, const std::string &strScraperName, bool bLoadedFromDb)
 Create a new EPG instance. More...
 
 CPVREpg (const CPVRChannelPtr &channel)
 Create a new EPG instance for a channel. More...
 
 ~CPVREpg (void) override
 Destroy this EPG instance. More...
 
bool Load (void)
 Load all entries for this table from the database. More...
 
CPVRChannelPtr Channel (void) const
 The channel this EPG belongs to. More...
 
int ChannelID (void) const
 The id of the channel this EPG belongs to. More...
 
void SetChannel (const CPVRChannelPtr &channel)
 Channel the channel tag linked to this EPG table. More...
 
const std::string & ScraperName (void) const
 Get the name of the scraper to use for this table. More...
 
bool UpdatePending (void) const
 Returns if there is a manual update pending for this EPG. More...
 
void ForceUpdate (void)
 Clear the current tags and schedule manual update. More...
 
const std::string & Name (void) const
 Get the name of this table. More...
 
int EpgID (void) const
 Get the database ID of this table. More...
 
bool HasValidEntries (void) const
 Check whether this EPG contains valid entries. More...
 
void Cleanup (const CDateTime &time)
 Remove all entries from this EPG that finished before the given time and that have no timers set. More...
 
void Cleanup (void)
 Remove all entries from this EPG that finished before the given time and that have no timers set. More...
 
void Clear (void)
 Remove all entries from this EPG. More...
 
CPVREpgInfoTagPtr GetTagNow (bool bUpdateIfNeeded=true) const
 Get the event that is occurring now. More...
 
CPVREpgInfoTagPtr GetTagNext () const
 Get the event that will occur next. More...
 
CPVREpgInfoTagPtr GetTagPrevious () const
 Get the event that occured previously. More...
 
CPVREpgInfoTagPtr GetTagBetween (const CDateTime &beginTime, const CDateTime &endTime, bool bUpdateFromClient=false)
 Get the event that occurs between the given begin and end time. More...
 
std::vector< CPVREpgInfoTagPtrGetTagsBetween (const CDateTime &beginTime, const CDateTime &endTime) const
 Get all events occurring between the given begin and end time. More...
 
CPVREpgInfoTagPtr GetTagByBroadcastId (unsigned int iUniqueBroadcastId) const
 Get the event matching the given unique broadcast id. More...
 
bool UpdateEntry (const EPG_TAG *data, int iClientId, bool bUpdateDatabase)
 Update an entry in this EPG. More...
 
bool UpdateEntry (const CPVREpgInfoTagPtr &tag, bool bUpdateDatabase)
 Update an entry in this EPG. More...
 
bool UpdateEntry (const CPVREpgInfoTagPtr &tag, EPG_EVENT_STATE newState, bool bUpdateDatabase)
 Update an entry in this EPG. More...
 
bool Update (const time_t start, const time_t end, int iUpdateTime, bool bForceUpdate=false)
 Update the EPG from 'start' till 'end'. More...
 
int Get (CFileItemList &results) const
 Get all EPG entries. More...
 
int Get (CFileItemList &results, const CPVREpgSearchFilter &filter) const
 Get all EPG entries that and apply a filter. More...
 
bool Persist (void)
 Persist this table in the database. More...
 
CDateTime GetFirstDate (void) const
 Get the start time of the first entry in this table. More...
 
CDateTime GetLastDate (void) const
 Get the end time of the last entry in this table. More...
 
CDateTime GetLastScanTime (void)
 Get the time the EPG data were last updated. More...
 
bool CheckPlayingEvent (void)
 Notify observers when the currently active tag changed. More...
 
bool NeedsSave (void) const
 Check whether this EPG has unsaved data. More...
 
bool IsValid (void) const
 Check whether this EPG is valid. More...
 
- Public Member Functions inherited from Observable
 Observable ()=default
 
virtual ~Observable ()=default
 
virtual Observableoperator= (const Observable &observable)
 
virtual void RegisterObserver (Observer *obs)
 Register an observer. More...
 
virtual void UnregisterObserver (Observer *obs)
 Unregister an observer. More...
 
virtual void NotifyObservers (const ObservableMessage message=ObservableMessageNone)
 Send a message to all observers when m_bObservableChanged is true. More...
 
virtual void SetChanged (bool bSetTo=true)
 Mark an observable changed. More...
 
virtual bool IsObserving (const Observer &obs) const
 Check whether this observable is being observed by an observer. More...
 

Static Public Member Functions

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

Friends

class CPVREpgDatabase
 

Additional Inherited Members

- Protected Member Functions inherited from Observable
void SendMessage (const ObservableMessage message)
 Send a message to all observer when m_bObservableChanged is true. More...
 
- Protected Attributes inherited from Observable
std::atomic< bool > m_bObservableChanged {false}
 
std::vector< Observer * > m_observers
 
CCriticalSection m_obsCritSection
 

Constructor & Destructor Documentation

§ CPVREpg() [1/2]

CPVREpg::CPVREpg ( int  iEpgID,
const std::string &  strName,
const std::string &  strScraperName,
bool  bLoadedFromDb 
)

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.
bLoadedFromDbTrue if this table was loaded from the database, false otherwise.

§ CPVREpg() [2/2]

CPVREpg::CPVREpg ( const CPVRChannelPtr channel)

Create a new EPG instance for a channel.

Parameters
channelThe channel to create the EPG for.

§ ~CPVREpg()

CPVREpg::~CPVREpg ( void  )
override

Destroy this EPG instance.

Member Function Documentation

§ Channel()

CPVRChannelPtr CPVREpg::Channel ( void  ) const

The channel this EPG belongs to.

Returns
The channel this EPG belongs to

§ ChannelID()

int CPVREpg::ChannelID ( void  ) const

The id of the channel this EPG belongs to.

Returns
The channel id or -1 if no channel

§ CheckPlayingEvent()

bool CPVREpg::CheckPlayingEvent ( void  )

Notify observers when the currently active tag changed.

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

§ Cleanup() [1/2]

void CPVREpg::Cleanup ( const CDateTime time)

Remove all entries from this EPG that finished before the given time and that have no timers set.

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

§ Cleanup() [2/2]

void CPVREpg::Cleanup ( void  )

Remove all entries from this EPG that finished before the given time and that have no timers set.

§ Clear()

void CPVREpg::Clear ( void  )

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 ( void  ) const

Get the database ID of this table.

Returns
The database ID of this table.

§ ForceUpdate()

void CPVREpg::ForceUpdate ( void  )

Clear the current tags and schedule manual update.

§ Get() [1/2]

int CPVREpg::Get ( CFileItemList results) const

Get all EPG entries.

Parameters
resultsThe file list to store the results in.
Returns
The amount of entries that were added.

§ Get() [2/2]

int CPVREpg::Get ( CFileItemList results,
const CPVREpgSearchFilter filter 
) const

Get all EPG entries that and apply a filter.

Parameters
resultsThe file list to store the results in.
filterThe filter to apply.
Returns
The amount of entries that were added.

§ GetFirstDate()

CDateTime CPVREpg::GetFirstDate ( void  ) const

Get the start time of the first entry in this table.

Returns
The first date in UTC.

§ GetLastDate()

CDateTime CPVREpg::GetLastDate ( void  ) const

Get the end time of the last entry in this table.

Returns
The last date in UTC.

§ GetLastScanTime()

CDateTime CPVREpg::GetLastScanTime ( void  )

Get the time the EPG data were last updated.

Returns
The last time this table was scanned.

§ GetTagBetween()

CPVREpgInfoTagPtr 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()

CPVREpgInfoTagPtr 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.

§ GetTagNext()

CPVREpgInfoTagPtr CPVREpg::GetTagNext ( ) const

Get the event that will occur next.

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

§ GetTagNow()

CPVREpgInfoTagPtr CPVREpg::GetTagNow ( bool  bUpdateIfNeeded = true) const

Get the event that is occurring now.

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

§ GetTagPrevious()

CPVREpgInfoTagPtr CPVREpg::GetTagPrevious ( ) const

Get the event that occured previously.

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

§ GetTagsBetween()

std::vector< CPVREpgInfoTagPtr > CPVREpg::GetTagsBetween ( const CDateTime beginTime,
const CDateTime endTime 
) const

Get all events occurring between the given begin and end time.

Parameters
beginTimeMinimum start time in UTC of the event.
endTimeMaximum end time in UTC of the event.
Returns
The tags found or an empty vector if none was found.

§ HasValidEntries()

bool CPVREpg::HasValidEntries ( void  ) const

Check whether this EPG contains valid entries.

Returns
True if it has valid entries, false if not.

§ IsValid()

bool CPVREpg::IsValid ( void  ) const

Check whether this EPG is valid.

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

§ Load()

bool CPVREpg::Load ( void  )

Load all entries for this table from the database.

Returns
True if any entries were loaded, false otherwise.

§ Name()

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

Get the name of this table.

Returns
The name of this table.

§ NeedsSave()

bool CPVREpg::NeedsSave ( void  ) const

Check whether this EPG has unsaved data.

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

§ Persist()

bool CPVREpg::Persist ( void  )

Persist this table in the database.

Returns
True if the table was persisted, false otherwise.

§ ScraperName()

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

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

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

§ SetChannel()

void CPVREpg::SetChannel ( const CPVRChannelPtr channel)

Channel the channel tag linked to this EPG table.

Parameters
channelThe new channel tag.

§ Update()

bool CPVREpg::Update ( const time_t  start,
const time_t  end,
int  iUpdateTime,
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.
bForceUpdateForce update from client even if it's not the time to
Returns
True if the update was successful, false otherwise.

§ UpdateEntry() [1/3]

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

Update an entry in this EPG.

Parameters
dataThe tag to update.
iClientIdThe id of the pvr client this event belongs to.
bUpdateDatabaseIf set to true, this event will be persisted in the database.
Returns
True if it was updated successfully, false otherwise.

§ UpdateEntry() [2/3]

bool CPVREpg::UpdateEntry ( const CPVREpgInfoTagPtr tag,
bool  bUpdateDatabase 
)

Update an entry in this EPG.

Parameters
tagThe tag to update.
bUpdateDatabaseIf set to true, this event will be persisted in the database.
Returns
True if it was updated successfully, false otherwise.

§ UpdateEntry() [3/3]

bool CPVREpg::UpdateEntry ( const CPVREpgInfoTagPtr tag,
EPG_EVENT_STATE  newState,
bool  bUpdateDatabase 
)

Update an entry in this EPG.

Parameters
tagThe tag to update.
newStatethe new state of the event.
bUpdateDatabaseIf set to true, this event will be persisted in the database.
Returns
True if it was updated successfully, false otherwise.

§ UpdatePending()

bool CPVREpg::UpdatePending ( void  ) 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 Function Documentation

§ CPVREpgDatabase

friend class CPVREpgDatabase
friend

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