本文整理汇总了C++中CPVRChannelGroups类的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelGroups类的具体用法?C++ CPVRChannelGroups怎么用?C++ CPVRChannelGroups使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPVRChannelGroups类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PVRTransferChannelGroup
void CAddonCallbacksPVR::PVRTransferChannelGroup(void *addonData, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group)
{
if (!handle)
{
CLog::Log(LOGERROR, "PVR - %s - invalid handler data", __FUNCTION__);
return;
}
CPVRChannelGroups *xbmcGroups = static_cast<CPVRChannelGroups *>(handle->dataAddress);
if (!group || !xbmcGroups)
{
CLog::Log(LOGERROR, "PVR - %s - invalid handler data", __FUNCTION__);
return;
}
if (strlen(group->strGroupName) == 0)
{
CLog::Log(LOGERROR, "PVR - %s - empty group name", __FUNCTION__);
return;
}
/* transfer this entry to the groups container */
CPVRChannelGroup transferGroup(*group);
xbmcGroups->UpdateFromClient(transferGroup);
}
示例2: bReturn
bool CPVRChannelGroup::RemoveDeletedChannels(const CPVRChannelGroup &channels)
{
bool bReturn(false);
CPVRChannelGroups *groups = g_PVRChannelGroups->Get(m_bRadio);
CSingleLock lock(m_critSection);
/* check for deleted channels */
for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end();)
{
CSingleLock lock(channels.m_critSection);
if (channels.m_members.find((*it).channel->StorageId()) == channels.m_members.end())
{
/* channel was not found */
CLog::Log(LOGINFO,"PVRChannelGroup - %s - deleted %s channel '%s' from group '%s'",
__FUNCTION__, m_bRadio ? "radio" : "TV", (*it).channel->ChannelName().c_str(), GroupName().c_str());
m_members.erase((*it).channel->StorageId());
//we need a copy of our iterators data so that we can find it later on
//if the vector has changed.
auto group = *it;
/* remove this channel from all non-system groups if this is the internal group */
if (IsInternalGroup())
{
groups->RemoveFromAllGroups((*it).channel);
/* since it was not found in the internal group, it was deleted from the backend */
group.channel->Delete();
}
//our vector can have been modified during the call to RemoveFromAllGroups
//make no assumption and search for the value to be removed
auto possiblyRemovedGroup = std::find_if(m_sortedMembers.begin(), m_sortedMembers.end(), [&group](const PVRChannelGroupMember& it)
{
return group.channel == it.channel &&
group.iChannelNumber == it.iChannelNumber &&
group.iSubChannelNumber == it.iSubChannelNumber;
});
if (possiblyRemovedGroup != m_sortedMembers.end())
m_sortedMembers.erase(possiblyRemovedGroup);
//We have to start over from the beginning, list can have been modified and
//resorted, there's no safe way to continue where we left of
it = m_sortedMembers.begin();
m_bChanged = true;
bReturn = true;
}
else
{
++it;
}
}
return bReturn;
}
示例3: SetPlayingGroup
void CPVRManager::SetPlayingGroup(const CPVRChannelPtr &channel)
{
CPVRChannelGroupPtr group = m_channelGroups->GetSelectedGroup(channel->IsRadio());
if (!group || !group->IsGroupMember(channel))
{
// The channel we'll switch to is not part of the current selected group.
// Set the first group as the selected group where the channel is a member.
CPVRChannelGroups *channelGroups = m_channelGroups->Get(channel->IsRadio());
std::vector<CPVRChannelGroupPtr> groups = channelGroups->GetGroupsByChannel(channel, true);
if (!groups.empty())
channelGroups->SetSelectedGroup(groups.front());
}
}
示例4: UpdateGroupsEntries
bool CPVRChannelGroups::UpdateGroupsEntries(const CPVRChannelGroups &groups)
{
CSingleLock lock(m_critSection);
// go through groups list and check for deleted groups
for (int iGroupPtr = m_groups.size() - 1; iGroupPtr > 0; iGroupPtr--)
{
CPVRChannelGroup existingGroup(*m_groups.at(iGroupPtr));
CPVRChannelGroupPtr group = groups.GetByName(existingGroup.GroupName());
// user defined group wasn't found
if (existingGroup.GroupType() == PVR_GROUP_TYPE_DEFAULT && !group)
{
CLog::Log(LOGDEBUG, "PVR - %s - user defined group %s with id '%u' does not exist on the client anymore; deleting it", __FUNCTION__, existingGroup.GroupName().c_str(), existingGroup.GroupID());
DeleteGroup(*m_groups.at(iGroupPtr));
}
}
// go through the groups list and check for new groups
for (std::vector<CPVRChannelGroupPtr>::const_iterator it = groups.m_groups.begin(); it != m_groups.end(); it++)
{
// check if this group is present in this container
CPVRChannelGroupPtr existingGroup = GetByName((*it)->GroupName());
// add it if not
if (!existingGroup)
m_groups.push_back(CPVRChannelGroupPtr(new CPVRChannelGroup(m_bRadio, -1, (*it)->GroupName())));
}
return true;
}
示例5: Get
bool CPVRDatabase::Get(CPVRChannelGroups &results)
{
bool bReturn = false;
std::string strQuery = PrepareSQL("SELECT * from channelgroups WHERE bIsRadio = %u", results.IsRadio());
if (ResultQuery(strQuery))
{
try
{
while (!m_pDS->eof())
{
CPVRChannelGroup data(m_pDS->fv("bIsRadio").get_asBool(), m_pDS->fv("idGroup").get_asInt(), m_pDS->fv("sName").get_asString());
data.SetGroupType(m_pDS->fv("iGroupType").get_asInt());
data.SetLastWatched((time_t) m_pDS->fv("iLastWatched").get_asInt());
data.SetHidden(m_pDS->fv("bIsHidden").get_asBool());
data.SetPosition(m_pDS->fv("iPosition").get_asInt());
results.Update(data);
CLog::Log(LOGDEBUG, "PVR - %s - group '%s' loaded from the database", __FUNCTION__, data.GroupName().c_str());
m_pDS->next();
}
m_pDS->close();
bReturn = true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s - couldn't load channels from the database", __FUNCTION__);
}
}
return bReturn;
}
示例6: Get
bool CPVRDatabase::Get(CPVRChannelGroups &results)
{
bool bReturn = false;
CStdString strQuery = FormatSQL("SELECT * from channelgroups WHERE bIsRadio = %u ORDER BY idGroup;", results.IsRadio());
if (ResultQuery(strQuery))
{
try
{
while (!m_pDS->eof())
{
CPVRChannelGroup data(m_pDS->fv("bIsRadio").get_asBool());
data.SetGroupID(m_pDS->fv("idGroup").get_asInt());
data.SetGroupName(m_pDS->fv("sName").get_asString());
results.Update(data);
CLog::Log(LOGDEBUG, "PVRDB - %s - group '%s' loaded from the database",
__FUNCTION__, data.GroupName().c_str());
m_pDS->next();
}
m_pDS->close();
bReturn = true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s - couldn't load channels from the database", __FUNCTION__);
}
}
return bReturn;
}
示例7: GetChannelGroupList
bool CPVRDatabase::GetChannelGroupList(CPVRChannelGroups &results, bool bRadio /* = false */)
{
bool bReturn = false;
CStdString strQuery = FormatSQL("SELECT * from ChannelGroup WHERE IsRadio = %u ORDER BY sortOrder\n", bRadio);
int iNumRows = ResultQuery(strQuery);
if (iNumRows > 0)
{
try
{
while (!m_pDS->eof())
{
CPVRChannelGroup data;
data.SetGroupID(m_pDS->fv("GroupId").get_asInt());
data.SetGroupName(m_pDS->fv("Name").get_asString());
data.SetSortOrder(m_pDS->fv("SortOrder").get_asInt());
results.push_back(data);
m_pDS->next();
}
bReturn = true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s - couldn't load channels from the database", __FUNCTION__);
}
}
m_pDS->close();
return bReturn;
}
示例8: UpdateGroupsEntries
bool CPVRChannelGroups::UpdateGroupsEntries(const CPVRChannelGroups &groups)
{
/* go through the groups list and check for new groups */
for (unsigned int iGroupPtr = 0; iGroupPtr < groups.size(); iGroupPtr++)
{
CPVRChannelGroup *group = groups.at(iGroupPtr);
/* check if this group is present in this container */
CPVRChannelGroup *existingGroup = (CPVRChannelGroup *) GetByName(group->GroupName());
if (existingGroup == NULL)
{
CPVRChannelGroup *newGroup = new CPVRChannelGroup(m_bRadio);
newGroup->SetGroupName(group->GroupName());
push_back(newGroup);
}
}
return true;
}
示例9: PVRTransferChannelGroup
void CAddonCallbacksPVR::PVRTransferChannelGroup(void *addonData, const PVR_HANDLE handle, const PVR_CHANNEL_GROUP *group)
{
CAddonCallbacks* addon = (CAddonCallbacks*) addonData;
if (addon == NULL || handle == NULL || group == NULL || handle->dataAddress == NULL)
{
CLog::Log(LOGERROR, "CAddonCallbacksPVR - %s - called with a null pointer", __FUNCTION__);
return;
}
if (strlen(group->strGroupName) == 0)
{
CLog::Log(LOGERROR, "CAddonCallbacksPVR - %s - empty group name", __FUNCTION__);
return;
}
CPVRChannelGroups *xbmcGroups = (CPVRChannelGroups *) handle->dataAddress;
CPVRChannelGroup xbmcGroup(*group);
/* transfer this entry to the groups container */
xbmcGroups->UpdateFromClient(xbmcGroup);
}
示例10: GetChannelGroups
JSONRPC_STATUS CPVROperations::GetChannelGroups(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRChannelGroupsContainer *channelGroupContainer = g_PVRChannelGroups;
if (channelGroupContainer == NULL)
return FailedToExecute;
CPVRChannelGroups *channelGroups = channelGroupContainer->Get(parameterObject["channeltype"].asString().compare("radio") == 0);
if (channelGroups == NULL)
return FailedToExecute;
int start, end;
vector<CPVRChannelGroupPtr> groupList = channelGroups->GetMembers();
HandleLimits(parameterObject, result, groupList.size(), start, end);
for (int index = start; index < end; index++)
FillChannelGroupDetails(groupList.at(index), parameterObject, result["channelgroups"], true);
return OK;
}