Kodi Documentation  19.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)
 Create a new EPG instance. More...
 
 CPVREpg (int iEpgID, const std::string &strName, const std::string &strScraperName, const std::shared_ptr< CPVREpgChannelData > &channelData)
 Create a new EPG instance. More...
 
 ~CPVREpg (void) override
 Destroy this EPG instance. More...
 
bool Load (const std::shared_ptr< CPVREpgDatabase > &database)
 Load all entries for this table from the given database. More...
 
std::shared_ptr< CPVREpgChannelDataGetChannelData () const
 Get data for the channel associated with this EPG. More...
 
void SetChannelData (const std::shared_ptr< CPVREpgChannelData > &data)
 Set data for the channel associated with this EPG. More...
 
int ChannelID (void) const
 The id of the channel associated with this EPG. 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. 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...
 
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 (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'. More...
 
std::vector< std::shared_ptr< CPVREpgInfoTag > > GetTags () const
 Get all EPG tags. More...
 
bool Persist (const std::shared_ptr< CPVREpgDatabase > &database)
 Persist this table in the given 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...
 
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 
)

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.

§ CPVREpg() [2/2]

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

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.

§ ~CPVREpg()

CPVREpg::~CPVREpg ( void  )
override

Destroy this EPG instance.

Member Function Documentation

§ ChannelID()

int CPVREpg::ChannelID ( void  ) 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 ( void  )

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.

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

§ GetChannelData()

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

Get data for the channel associated with this EPG.

Returns
The data.

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

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

§ GetTags()

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

Get all EPG tags.

Returns
The tags.

§ 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 ( const std::shared_ptr< CPVREpgDatabase > &  database)

Load all entries for this table from the given database.

Parameters
databaseThe 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 ( const std::shared_ptr< CPVREpgDatabase > &  database)

Persist this table in the given database.

Parameters
databaseThe 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.

§ SetChannelData()

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

Set data for the channel associated with this EPG.

Parameters
dataThe data.

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

§ 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: