int CPVRChannelGroup::GetEPGAll(CFileItemList &results, bool bIncludeChannelsWithoutEPG /* = false */) const { int iInitialSize = results.Size(); CEpgInfoTagPtr epgTag; CPVRChannelPtr channel; CSingleLock lock(m_critSection); for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::const_iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end(); ++it) { channel = (*it).channel; if (!channel->IsHidden()) { int iAdded = 0; CEpgPtr epg = channel->GetEPG(); if (epg) { // XXX channel pointers aren't set in some occasions. this works around the issue, but is not very nice epg->SetChannel(channel); iAdded = epg->Get(results); } if (bIncludeChannelsWithoutEPG && iAdded == 0) { // Add dummy EPG tag associated with this channel epgTag = CEpgInfoTag::CreateDefaultTag(); epgTag->SetPVRChannel(channel); results.Add(CFileItemPtr(new CFileItem(epgTag))); } } } return results.Size() - iInitialSize; }
int CPVRChannel::GetEPG(CFileItemList &results) const { CEpgPtr epg = GetEPG(); if (!epg) { CLog::Log(LOGDEBUG, "PVR - %s - cannot get EPG for channel '%s'", __FUNCTION__, m_strChannelName.c_str()); return -1; } return epg->Get(results); }
JSONRPC_STATUS CPVROperations::GetBroadcasts(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; CPVRChannelGroupsContainerPtr channelGroupContainer = g_PVRManager.ChannelGroups(); if (!channelGroupContainer) return FailedToExecute; CPVRChannelPtr channel = channelGroupContainer->GetChannelById((int)parameterObject["channelid"].asInteger()); if (channel == NULL) return InvalidParams; CEpgPtr channelEpg = channel->GetEPG(); if (!channelEpg) return InternalError; CFileItemList programFull; channelEpg->Get(programFull); HandleFileItemList("broadcastid", false, "broadcasts", programFull, parameterObject, result, programFull.Size(), true); return OK; }