11 #include "pvr/channels/PVRChannelGroupSettings.h" 12 #include "pvr/channels/PVRChannelNumber.h" 13 #include "pvr/channels/PVRChannelsPath.h" 14 #include "utils/EventStream.h" 26 #define PVR_GROUP_TYPE_DEFAULT 0 27 #define PVR_GROUP_TYPE_INTERNAL 1 28 #define PVR_GROUP_TYPE_USER_DEFINED 2 33 class CPVRChannelGroupMember;
40 IGNORE_NUMBERING_FROM_ONE = 1
43 using GroupMemberPair =
44 std::pair<std::shared_ptr<CPVRChannelGroupMember>, std::shared_ptr<CPVRChannelGroupMember>>;
51 static const int INVALID_GROUP_ID = -1;
59 const std::shared_ptr<CPVRChannelGroup>& allChannelsGroup);
67 const std::shared_ptr<CPVRChannelGroup>& allChannelsGroup);
92 const std::map<std::pair<int, int>, std::shared_ptr<CPVRChannel>>& channels,
93 const std::vector<std::shared_ptr<CPVRClient>>& clients);
110 virtual bool UpdateFromClients(
const std::vector<std::shared_ptr<CPVRClient>>& clients);
138 virtual bool RemoveFromGroup(
const std::shared_ptr<CPVRChannel>& channel);
145 virtual bool AppendToGroup(
const std::shared_ptr<CPVRChannel>& channel);
164 virtual bool IsGroupMember(
const std::shared_ptr<CPVRChannel>& channel)
const;
249 bool Renumber(RenumberMode mode = NORMAL);
254 void UseBackendChannelOrderChanged()
override;
255 void UseBackendChannelNumbersChanged()
override;
256 void StartGroupChannelNumbersFromOneChanged()
override;
264 int iCurrentChannel = -1)
const;
300 const std::shared_ptr<CPVRChannelGroupMember>& groupMember)
const;
308 const std::shared_ptr<CPVRChannelGroupMember>& groupMember)
const;
315 std::shared_ptr<CPVRChannel>
GetByChannelID(
int iChannelID)
const;
329 std::vector<std::shared_ptr<CPVRChannelGroupMember>>
GetMembers(
330 Include eFilter = Include::ALL)
const;
387 const std::string& strChannelName,
388 const std::string& strIconPath,
393 bool bParentalLocked,
395 bool bUserSetHidden);
403 std::shared_ptr<CPVRChannel>
GetByUniqueID(
int iUniqueChannelId,
int iClientID)
const;
410 std::shared_ptr<CPVRChannelGroupMember>
GetByUniqueID(
const std::pair<int, int>&
id)
const;
412 bool SetHidden(
bool bHidden);
413 bool IsHidden()
const;
415 int GetPosition()
const;
416 void SetPosition(
int iPosition);
464 const std::vector<std::shared_ptr<CPVRChannelGroupMember>>& groupMembers);
471 bool UpdateGroupEntries(
const std::vector<std::shared_ptr<CPVRChannelGroupMember>>& groupMembers);
488 std::shared_ptr<CPVRChannelGroupSettings> GetSettings()
const;
499 std::vector<std::shared_ptr<CPVRChannelGroupMember>>
501 std::map<std::pair<int, int>, std::shared_ptr<CPVRChannelGroupMember>>
503 mutable CCriticalSection m_critSection;
504 std::vector<int> m_failedClients;
506 mutable std::shared_ptr<CPVRChannelGroupSettings> m_settings;
509 static CCriticalSection m_settingsSingletonCritSection;
510 static std::weak_ptr<CPVRChannelGroupSettings> m_settingsSingleton;
518 int LoadFromDatabase(
const std::vector<std::shared_ptr<CPVRClient>>& clients);
524 void DeleteGroupMembersFromDb(
525 const std::vector<std::shared_ptr<CPVRChannelGroupMember>>& membersToDelete);
532 bool UpdateFromClient(
const std::shared_ptr<CPVRChannelGroupMember>& groupMember);
539 bool AddAndUpdateGroupMembers(
540 const std::vector<std::shared_ptr<CPVRChannelGroupMember>>& groupMembers);
542 void OnSettingChanged();
544 std::shared_ptr<CPVRChannelGroup> m_allChannelsGroup;
546 bool m_bDeleted =
false;
void SetLastWatched(time_t iLastWatched)
Last time group has been watched.
Definition: PVRChannelGroup.cpp:1028
virtual bool LoadFromDatabase(const std::map< std::pair< int, int >, std::shared_ptr< CPVRChannel >> &channels, const std::vector< std::shared_ptr< CPVRClient >> &clients)
Load the channels from the database.
Definition: PVRChannelGroup.cpp:103
uint64_t m_iLastOpened
Definition: PVRChannelGroup.h:496
std::shared_ptr< CPVRChannelGroupMember > GetByChannelNumber(const CPVRChannelNumber &channelNumber) const
Get a channel group member given it's active channel number.
Definition: PVRChannelGroup.cpp:364
void Sort()
Sort the group.
Definition: PVRChannelGroup.cpp:215
std::shared_ptr< CPVRChannelGroupMember > GetNextChannelGroupMember(const std::shared_ptr< CPVRChannelGroupMember > &groupMember) const
Get the next channel group member in this group.
Definition: PVRChannelGroup.cpp:380
Definition: ContextMenuManager.h:24
int CleanupCachedImages()
Erase stale texture db entries and image files.
Definition: PVRChannelGroup.cpp:1163
std::shared_ptr< CPVRChannelGroupMember > GetLastPlayedChannelGroupMember(int iCurrentChannel=-1) const
Get the channel group member that was played last.
Definition: PVRChannelGroup.cpp:302
time_t m_iLastWatched
Definition: PVRChannelGroup.h:495
CPVRChannelNumber GetClientChannelNumber(const std::shared_ptr< CPVRChannel > &channel) const
Get the client channel number in this group of the given channel.
Definition: PVRChannelGroup.cpp:356
std::shared_ptr< CPVRChannel > GetByChannelID(int iChannelID) const
Get a channel given it's channel ID.
Definition: PVRChannelGroup.cpp:292
bool SetChannelNumber(const std::shared_ptr< CPVRChannel > &channel, const CPVRChannelNumber &channelNumber)
Change the channelnumber of a group. Used by CGUIDialogPVRChannelManager. Call SortByChannelNumber() ...
Definition: PVRChannelGroup.cpp:171
void SetGroupType(int iGroupType)
Set the type of this group.
Definition: PVRChannelGroup.cpp:980
virtual bool UpdateFromClients(const std::vector< std::shared_ptr< CPVRClient >> &clients)
Update data with channel group members from the given clients, sync with local data.
Definition: PVRChannelGroup.cpp:138
virtual bool IsGroupMember(const std::shared_ptr< CPVRChannel > &channel) const
Check whether a channel is in this container.
Definition: PVRChannelGroup.cpp:789
Definition: PVRChannelsPath.h:17
virtual std::vector< std::shared_ptr< CPVRChannelGroupMember > > RemoveDeletedGroupMembers(const std::vector< std::shared_ptr< CPVRChannelGroupMember >> &groupMembers)
Remove deleted group members from this group.
Definition: PVRChannelGroup.cpp:653
void FillAddonData(PVR_CHANNEL_GROUP &group) const
Copy over data to the given PVR_CHANNEL_GROUP instance.
Definition: PVRChannelGroup.cpp:72
std::shared_ptr< CPVRChannel > GetByUniqueID(int iUniqueChannelId, int iClientID) const
Get a channel given the channel number on the client.
Definition: PVRChannelGroup.cpp:284
void GetChannelNumbers(std::vector< std::string > &channelNumbers) const
Get the list of active channel numbers in a group.
Definition: PVRChannelGroup.cpp:466
std::string GroupName() const
The name of this group.
Definition: PVRChannelGroup.cpp:996
int m_iGroupType
Definition: PVRChannelGroup.h:490
bool UpdateGroupEntries(const std::vector< std::shared_ptr< CPVRChannelGroupMember >> &groupMembers)
Update the current channel group members with the given list.
Definition: PVRChannelGroup.cpp:698
virtual bool AppendToGroup(const std::shared_ptr< CPVRChannel > &channel)
Append a channel to this container.
Definition: PVRChannelGroup.cpp:753
CPVRChannelNumber GetChannelNumber(const std::shared_ptr< CPVRChannel > &channel) const
Get the channel number in this group of the given channel.
Definition: PVRChannelGroup.cpp:348
void SetLastOpened(uint64_t iLastOpened)
Set the time in milliseconds from epoch this group was last opened.
Definition: PVRChannelGroup.cpp:1048
bool Persist()
Persist changed or new data.
Definition: PVRChannelGroup.cpp:795
bool HasChannels() const
Does this container holds channels.
Definition: PVRChannelGroup.cpp:1113
bool m_bChanged
Definition: PVRChannelGroup.h:493
size_t Size() const
Definition: PVRChannelGroup.cpp:1107
virtual size_t GetNumHiddenChannels() const
The amount of hidden channels in this container.
Definition: PVRChannelGroup.h:342
bool HasValidDataForClients(const std::vector< std::shared_ptr< CPVRClient >> &clients) const
Check, whether data for given pvr clients are currently valid. For instance, data can be invalid beca...
Definition: PVRChannelGroup.cpp:624
void SetGroupName(const std::string &strGroupName)
Change the name of this group.
Definition: PVRChannelGroup.cpp:1002
CPVRChannelGroup(const CPVRChannelsPath &path, const std::shared_ptr< CPVRChannelGroup > &allChannelsGroup)
Create a new channel group instance.
Definition: PVRChannelGroup.cpp:40
bool UpdateChannelNumbersFromAllChannelsGroup()
Update the channel numbers according to the all channels group and publish event. ...
Definition: PVRChannelGroup.cpp:633
std::shared_ptr< CPVRChannelGroupMember > GetPreviousChannelGroupMember(const std::shared_ptr< CPVRChannelGroupMember > &groupMember) const
Get the previous channel group member in this group.
Definition: PVRChannelGroup.cpp:408
const CPVRChannelsPath & GetPath() const
Get the path of this group.
Definition: PVRChannelGroup.cpp:150
bool Renumber(RenumberMode mode=NORMAL)
Remove invalid channels and updates the channel numbers.
Definition: PVRChannelGroup.cpp:844
bool m_bLoaded
Definition: PVRChannelGroup.h:492
bool HasChanges() const
Definition: PVRChannelGroup.cpp:907
int m_iPosition
Definition: PVRChannelGroup.h:498
virtual bool RemoveFromGroup(const std::shared_ptr< CPVRChannel > &channel)
Remove a channel from this container.
Definition: PVRChannelGroup.cpp:728
Definition: SmartPlayList.cpp:137
void SortByClientChannelNumber()
Sort the current channel list by client channel number.
Definition: PVRChannelGroup.cpp:230
"C" PVR add-on channel group.
Definition: pvr_channel_groups.h:30
int GroupID() const
The database ID of this group.
Definition: PVRChannelGroup.cpp:962
bool HasValidDataForClient(int iClientId) const
Check, whether data for a given pvr client are currently valid. For instance, data can be invalid bec...
Definition: PVRChannelGroup.cpp:618
std::map< std::pair< int, int >, std::shared_ptr< CPVRChannelGroupMember > > m_members
Definition: PVRChannelGroup.h:502
bool SortAndRenumber()
Sort the group and fix up channel numbers.
Definition: PVRChannelGroup.cpp:223
void SetPath(const CPVRChannelsPath &path)
Set the path of this group.
Definition: PVRChannelGroup.cpp:156
std::vector< std::shared_ptr< CPVRChannelGroupMember > > GetMembers(Include eFilter=Include::ALL) const
Get the current members of this group.
Definition: PVRChannelGroup.cpp:436
Definition: PVRDatabase.h:33
bool HasNewChannels() const
Definition: PVRChannelGroup.cpp:900
time_t LastWatched() const
Definition: PVRChannelGroup.cpp:1022
bool IsInternalGroup() const
Check if this group is the internal group containing all channels.
Definition: PVRChannelGroup.h:170
bool UpdateChannel(const std::pair< int, int > &storageId, const std::string &strChannelName, const std::string &strIconPath, int iEPGSource, int iChannelNumber, bool bHidden, bool bEPGEnabled, bool bParentalLocked, bool bUserSetIcon, bool bUserSetHidden)
Update a channel group member with given data.
Definition: PVRChannelGroup.cpp:1062
Definition: PVRChannelNumber.h:15
bool m_bHidden
Definition: PVRChannelGroup.h:497
Definition: PVRChannelGroupSettings.h:20
virtual bool CreateChannelEpgs(bool bForce=false)
Create an EPG table for each channel.
Definition: PVRChannelGroup.cpp:1119
bool IsDeleted() const
Whether this group is deleted.
Definition: PVRChannelGroup.h:449
virtual void Unload()
Clear all data.
Definition: PVRChannelGroup.cpp:130
uint64_t LastOpened() const
Definition: PVRChannelGroup.cpp:1042
int m_iGroupId
Definition: PVRChannelGroup.h:491
bool UpdateClientPriorities()
Update the priority for all members of all channel groups.
Definition: PVRChannelGroup.cpp:242
void SetGroupID(int iGroupId)
Set the database ID of this group.
Definition: PVRChannelGroup.cpp:967
Definition: PVRChannelGroup.h:46
GroupMemberPair GetLastAndPreviousToLastPlayedChannelGroupMember() const
Get the last and previous to last played channel group members.
Definition: PVRChannelGroup.cpp:323
bool IsRadio() const
True if this group holds radio channels, false if it holds TV channels.
Definition: PVRChannelGroup.cpp:1016
bool IsNew() const
Definition: PVRChannelGroup.cpp:913
std::vector< std::shared_ptr< CPVRChannelGroupMember > > m_sortedMembers
Definition: PVRChannelGroup.h:500
void SortByChannelNumber()
Sort the current channel list by channel number.
Definition: PVRChannelGroup.cpp:236
void Delete()
Remove this group from database.
Definition: PVRChannelGroup.cpp:826
CEventStream< PVREvent > & Events()
Query the events available for CEventStream.
Definition: PVRChannelGroup.h:83
int GroupType() const
Return the type of this group.
Definition: PVRChannelGroup.cpp:991