4 * Copyright (C) 2012-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
23 #include "PVRChannelGroup.h"
27 class CPVRChannelGroups;
30 /** XBMC's internal group, the group containing all channels */
32 class CPVRChannelGroupInternal : public CPVRChannelGroup
34 friend class CPVRChannelGroups;
35 friend class CPVRDatabase;
39 * @brief Create a new internal channel group.
40 * @param bRadio True if this group holds radio channels.
42 CPVRChannelGroupInternal(bool bRadio);
44 CPVRChannelGroupInternal(const CPVRChannelGroup &group);
46 virtual ~CPVRChannelGroupInternal(void);
49 * @brief The amount of channels in this container.
50 * @return The amount of channels in this container.
52 int GetNumHiddenChannels() const { return m_iHiddenChannels; }
55 * @brief Add or update a channel in this table.
56 * @param channel The channel to update.
57 * @return True if the channel was updated and persisted.
59 bool UpdateChannel(const CPVRChannel &channel);
62 * @brief Add a channel to this internal group.
63 * @param iChannelNumber The channel number to use for this channel or 0 to add it to the back.
65 bool InsertInGroup(CPVRChannel &channel, int iChannelNumber = 0);
68 * @brief Callback for add-ons to update a channel.
69 * @param channel The updated channel.
70 * @return True if the channel has been updated succesfully, false otherwise.
72 void UpdateFromClient(const CPVRChannel &channel, unsigned int iChannelNumber = 0);
75 * @see CPVRChannelGroup::IsGroupMember
77 bool IsGroupMember(const CPVRChannel &channel) const;
80 * @see CPVRChannelGroup::AddToGroup
82 bool AddToGroup(CPVRChannel &channel, int iChannelNumber = 0);
85 * @see CPVRChannelGroup::RemoveFromGroup
87 bool RemoveFromGroup(const CPVRChannel &channel);
90 * @see CPVRChannelGroup::MoveChannel
92 bool MoveChannel(unsigned int iOldChannelNumber, unsigned int iNewChannelNumber, bool bSaveInDb = true);
95 * @see CPVRChannelGroup::GetMembers
97 int GetMembers(CFileItemList &results, bool bGroupMembers = true) const;
100 * @brief Check whether the group name is still correct after the language setting changed.
102 void CheckGroupName(void);
105 * @brief Create an EPG table for each channel.
106 * @brief bForce Create the tables, even if they already have been created before.
107 * @return True if all tables were created successfully, false otherwise.
109 bool CreateChannelEpgs(bool bForce = false);
111 bool AddNewChannel(const CPVRChannel &channel, unsigned int iChannelNumber = 0) { UpdateFromClient(channel, iChannelNumber); return true; }
115 * @brief Load all channels from the database.
116 * @param bCompress Compress the database after changing anything.
117 * @return The amount of channels that were loaded.
119 int LoadFromDb(bool bCompress = false);
122 * @brief Load all channels from the clients.
123 * @return True when updated succesfully, false otherwise.
125 bool LoadFromClients(void);
128 * @brief Check if this group is the internal group containing all channels.
129 * @return True if it's the internal group, false otherwise.
131 bool IsInternalGroup(void) const { return true; }
134 * @brief Update the current channel list with the given list.
136 * Update the current channel list with the given list.
137 * Only the new channels will be present in the passed list after this call.
139 * @param channels The channels to use to update this list.
140 * @return True if everything went well, false otherwise.
142 bool UpdateGroupEntries(const CPVRChannelGroup &channels);
144 bool AddAndUpdateChannels(const CPVRChannelGroup &channels, bool bUseBackendChannelNumbers);
147 * @brief Refresh the channel list from the clients.
152 * @brief Remove invalid channels and updates the channel numbers.
157 * @brief Load the channels from the database.
159 * Load the channels from the database.
160 * If no channels are stored in the database, then the channels will be loaded from the clients.
162 * @return True when loaded successfully, false otherwise.
167 * @brief Update the vfs paths of all channels.
169 void UpdateChannelPaths(void);
171 void CreateChannelEpg(CPVRChannelPtr channel, bool bForce = false);
173 int m_iHiddenChannels; /*!< the amount of hidden channels in this container */