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

#include <PVRChannelGroups.h>

Inheritance diagram for PVR::CPVRChannelGroups:
ISettingCallback

Public Member Functions

 CPVRChannelGroups (bool bRadio)
 Create a new group container.
 
virtual ~CPVRChannelGroups ()
 
void OnSettingChanged (const std::shared_ptr< const CSetting > &setting) override
 The value of the given setting has changed.
 
void Unload ()
 Remove all groups from this container.
 
bool LoadFromDatabase (const std::vector< std::shared_ptr< CPVRClient > > &clients)
 Load all channel groups and all channels from PVR database.
 
std::shared_ptr< CPVRChannelGroupFactoryGetGroupFactory () const
 Get the channel group factory.
 
size_t Size () const
 
bool Update (const std::shared_ptr< CPVRChannelGroup > &group, bool bUpdateFromClient=false)
 Update a group or add it if it's not in here yet.
 
bool UpdateFromClient (const std::shared_ptr< CPVRChannelGroup > &group)
 Called by the add-on callback to add a new group.
 
std::shared_ptr< CPVRChannelGroupMemberGetChannelGroupMemberByPath (const CPVRChannelsPath &path) const
 Get a channel group member given its path.
 
std::vector< std::shared_ptr< CPVRChannelGroupMember > > GetMembersAvailableForGroup (const std::shared_ptr< const CPVRChannelGroup > &group) const
 Get all channel group members that could be added to the given group.
 
std::shared_ptr< CPVRChannelGroupGetById (int iGroupId) const
 Get a pointer to a channel group given its ID.
 
std::shared_ptr< CPVRChannelGroupGetGroupByPath (const std::string &strPath) const
 Get a channel group given its path.
 
std::shared_ptr< CPVRChannelGroupGetByName (const std::string &strName, int clientID) const
 Get a group given its name.
 
std::shared_ptr< CPVRChannelGroupGetGroupAll () const
 Get the group that contains all channels.
 
std::shared_ptr< CPVRChannelGroupGetFirstGroup () const
 
std::shared_ptr< CPVRChannelGroupGetLastGroup () const
 
GroupMemberPair GetLastAndPreviousToLastPlayedChannelGroupMember () const
 
std::shared_ptr< CPVRChannelGroupGetLastOpenedGroup () const
 
std::vector< std::shared_ptr< CPVRChannelGroup > > GetMembers (bool bExcludeHidden=false) const
 Get the list of groups.
 
std::shared_ptr< CPVRChannelGroupGetPreviousGroup (const CPVRChannelGroup &group) const
 Get the previous group in this container.
 
std::shared_ptr< CPVRChannelGroupGetNextGroup (const CPVRChannelGroup &group) const
 Get the next group in this container.
 
std::shared_ptr< CPVRChannelGroupAddGroup (const std::string &strName)
 Add a group to this container.
 
bool DeleteGroup (const std::shared_ptr< CPVRChannelGroup > &group)
 Remove a group from this container and delete it from the database.
 
bool HideGroup (const std::shared_ptr< CPVRChannelGroup > &group, bool bHide)
 Hide/unhide a group in this container.
 
bool SetGroupName (const std::shared_ptr< CPVRChannelGroup > &group, const std::string &newGroupName, bool isUserSetName)
 Change the name of the given group.
 
bool AppendToGroup (const std::shared_ptr< CPVRChannelGroup > &group, const std::shared_ptr< const CPVRChannelGroupMember > &groupMember)
 Append a channel group member to the given group.
 
bool RemoveFromGroup (const std::shared_ptr< CPVRChannelGroup > &group, const std::shared_ptr< CPVRChannelGroupMember > &groupMember)
 Remove a channel group member from the given group.
 
bool ResetGroupPositions (const std::vector< std::string > &sortedGroupPaths)
 Reset the position of the given groups, then resort groups.
 
bool PersistAll ()
 Persist all changes in channel groups.
 
bool IsRadio () const
 
bool UpdateFromClients (const std::vector< std::shared_ptr< CPVRClient > > &clients, bool bChannelsOnly=false)
 Update data with groups and channels from the given clients, sync with local data.
 
bool UpdateChannelNumbersFromAllChannelsGroup ()
 Update the channel numbers across the channel groups from the all channels group.
 
int CleanupCachedImages ()
 Erase stale texture db entries and image files.
 
- Public Member Functions inherited from ISettingCallback
virtual ~ISettingCallback ()=default
 
virtual bool OnSettingChanging (const std::shared_ptr< const CSetting > &setting)
 The value of the given setting is being changed.
 
virtual void OnSettingAction (const std::shared_ptr< const CSetting > &setting)
 The given setting has been activated.
 
virtual bool OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
 The given setting needs to be updated.
 
virtual void OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName)
 The given property of the given setting has changed.
 

Detailed Description

A container class for channel groups

Constructor & Destructor Documentation

◆ CPVRChannelGroups()

CPVRChannelGroups::CPVRChannelGroups ( bool bRadio)
explicit

Create a new group container.

Parameters
bRadioTrue if this is a container for radio channels, false if it is for tv channels.

◆ ~CPVRChannelGroups()

CPVRChannelGroups::~CPVRChannelGroups ( )
virtual

Member Function Documentation

◆ AddGroup()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::AddGroup ( const std::string & strName)

Add a group to this container.

Parameters
strNameThe name of the group.
Returns
The new group on success, nullptr otherwise.

◆ AppendToGroup()

bool CPVRChannelGroups::AppendToGroup ( const std::shared_ptr< CPVRChannelGroup > & group,
const std::shared_ptr< const CPVRChannelGroupMember > & groupMember )

Append a channel group member to the given group.

Parameters
groupThe group.
groupMemberThe channel group member to append.
Returns
True if the channel group member was appended, false otherwise.

◆ CleanupCachedImages()

int CPVRChannelGroups::CleanupCachedImages ( )

Erase stale texture db entries and image files.

Returns
number of cleaned up images.

◆ DeleteGroup()

bool CPVRChannelGroups::DeleteGroup ( const std::shared_ptr< CPVRChannelGroup > & group)

Remove a group from this container and delete it from the database.

Parameters
groupThe group to delete.
Returns
True if it was deleted successfully, false if not.

◆ GetById()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetById ( int iGroupId) const

Get a pointer to a channel group given its ID.

Parameters
iGroupIdThe ID of the group.
Returns
The group or NULL if it wasn't found.

◆ GetByName()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetByName ( const std::string & strName,
int clientID ) const

Get a group given its name.

Parameters
strNameThe name.
clientIDThe id of the client of the group to obtain or PVR_GROUP_CLIENT_ID_LOCAL for local groups.
Returns
The group or NULL if it wasn't found.

◆ GetChannelGroupMemberByPath()

std::shared_ptr< CPVRChannelGroupMember > CPVRChannelGroups::GetChannelGroupMemberByPath ( const CPVRChannelsPath & path) const

Get a channel group member given its path.

Parameters
strPathThe path to the channel group member
Returns
The channel group member, or nullptr if not found

◆ GetFirstGroup()

std::shared_ptr< CPVRChannelGroup > PVR::CPVRChannelGroups::GetFirstGroup ( ) const
inline
Returns
The first group in this container, which always is the group with all channels.

◆ GetGroupAll()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetGroupAll ( ) const

Get the group that contains all channels.

Returns
The group that contains all channels.

◆ GetGroupByPath()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetGroupByPath ( const std::string & strPath) const

Get a channel group given its path.

Parameters
strPathThe path to the channel group
Returns
The channel group, or nullptr if not found

◆ GetGroupFactory()

std::shared_ptr< CPVRChannelGroupFactory > PVR::CPVRChannelGroups::GetGroupFactory ( ) const
inline

Get the channel group factory.

Returns
The factory.

◆ GetLastAndPreviousToLastPlayedChannelGroupMember()

GroupMemberPair CPVRChannelGroups::GetLastAndPreviousToLastPlayedChannelGroupMember ( ) const
Returns
The last and previous to last played channel group members. pair.first contains the last, pair.second the previous to last member.

◆ GetLastGroup()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetLastGroup ( ) const
Returns
The last group in this container.

◆ GetLastOpenedGroup()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetLastOpenedGroup ( ) const
Returns
The last opened group.

◆ GetMembers()

std::vector< std::shared_ptr< CPVRChannelGroup > > CPVRChannelGroups::GetMembers ( bool bExcludeHidden = false) const

Get the list of groups.

Parameters
groupsThe list to store the results in.
bExcludeHiddenWhenever to exclude hidden channel groups.
Returns
The amount of items that were added.

◆ GetMembersAvailableForGroup()

std::vector< std::shared_ptr< CPVRChannelGroupMember > > CPVRChannelGroups::GetMembersAvailableForGroup ( const std::shared_ptr< const CPVRChannelGroup > & group) const

Get all channel group members that could be added to the given group.

Parameters
groupThe group
Returns
The channel group members that could be added to the group

◆ GetNextGroup()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetNextGroup ( const CPVRChannelGroup & group) const

Get the next group in this container.

Parameters
groupThe current group.
Returns
The next group or the group containing all channels if it wasn't found.

◆ GetPreviousGroup()

std::shared_ptr< CPVRChannelGroup > CPVRChannelGroups::GetPreviousGroup ( const CPVRChannelGroup & group) const

Get the previous group in this container.

Parameters
groupThe current group.
Returns
The previous group or the group containing all channels if it wasn't found.

◆ HideGroup()

bool CPVRChannelGroups::HideGroup ( const std::shared_ptr< CPVRChannelGroup > & group,
bool bHide )

Hide/unhide a group in this container.

Parameters
groupThe group to hide/unhide.
bHideTrue to hide the group, false to unhide it.
Returns
True on success, false otherwise.

◆ IsRadio()

bool PVR::CPVRChannelGroups::IsRadio ( ) const
inline
Returns
True when this container contains radio groups, false otherwise

◆ LoadFromDatabase()

bool CPVRChannelGroups::LoadFromDatabase ( const std::vector< std::shared_ptr< CPVRClient > > & clients)

Load all channel groups and all channels from PVR database.

Parameters
clientsThe PVR clients data should be loaded for. Leave empty for all clients.
Returns
True on success, false otherwise.

◆ OnSettingChanged()

void CPVRChannelGroups::OnSettingChanged ( const std::shared_ptr< const CSetting > & setting)
overridevirtual

The value of the given setting has changed.

This callback is triggered whenever the value of a setting has been successfully changed (i.e. none of the OnSettingChanging() handlers) has reverted the change.

Parameters
settingThe setting whose value has been changed

Reimplemented from ISettingCallback.

◆ PersistAll()

bool CPVRChannelGroups::PersistAll ( )

Persist all changes in channel groups.

Returns
True if everything was persisted, false otherwise.

◆ RemoveFromGroup()

bool CPVRChannelGroups::RemoveFromGroup ( const std::shared_ptr< CPVRChannelGroup > & group,
const std::shared_ptr< CPVRChannelGroupMember > & groupMember )

Remove a channel group member from the given group.

Parameters
groupThe group.
groupMemberThe channel group member to remove.
Returns
True if the channel group member was removed, false otherwise.

◆ ResetGroupPositions()

bool CPVRChannelGroups::ResetGroupPositions ( const std::vector< std::string > & sortedGroupPaths)

Reset the position of the given groups, then resort groups.

Parameters
sortedGroupPathsThe paths of the groups to re-position.
Returns
True if any group position was changed, false otherwise.

◆ SetGroupName()

bool CPVRChannelGroups::SetGroupName ( const std::shared_ptr< CPVRChannelGroup > & group,
const std::string & newGroupName,
bool isUserSetName )

Change the name of the given group.

Parameters
groupThe group.
newGroupNameThe new group name.
isUserSetNameWhether the name was set by the user.
Returns
True if the group name was changed, false otherwise.

◆ Size()

size_t PVR::CPVRChannelGroups::Size ( ) const
inline
Returns
Amount of groups in this container

◆ Unload()

void CPVRChannelGroups::Unload ( )

Remove all groups from this container.

◆ Update()

bool CPVRChannelGroups::Update ( const std::shared_ptr< CPVRChannelGroup > & group,
bool bUpdateFromClient = false )

Update a group or add it if it's not in here yet.

Parameters
groupThe group to update.
bUpdateFromClientTrue to save the changes in the db.
Returns
True if the group was added or update successfully, false otherwise.
Todo
If a group was renamed in the backend, no chance to find it here! PVR API should be extended by a uuid for channel groups which never must change, not even after rename.

◆ UpdateChannelNumbersFromAllChannelsGroup()

bool CPVRChannelGroups::UpdateChannelNumbersFromAllChannelsGroup ( )

Update the channel numbers across the channel groups from the all channels group.

Returns
True if any channel number was changed, false otherwise.

◆ UpdateFromClient()

bool CPVRChannelGroups::UpdateFromClient ( const std::shared_ptr< CPVRChannelGroup > & group)

Called by the add-on callback to add a new group.

Parameters
groupThe group to add
Returns
True when updated, false otherwise

◆ UpdateFromClients()

bool CPVRChannelGroups::UpdateFromClients ( const std::vector< std::shared_ptr< CPVRClient > > & clients,
bool bChannelsOnly = false )

Update data with groups and channels from the given clients, sync with local data.

Parameters
clientsThe clients to fetch data from. Leave empty to fetch data from all created clients.
bChannelsOnlySet to true to only update channels, not the groups themselves.
Returns
True on success, false otherwise.

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