本文整理汇总了C++中CPVRChannelPtr::StorageId方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr::StorageId方法的具体用法?C++ CPVRChannelPtr::StorageId怎么用?C++ CPVRChannelPtr::StorageId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelPtr
的用法示例。
在下文中一共展示了CPVRChannelPtr::StorageId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddToGroup
bool CPVRChannelGroup::AddToGroup(const CPVRChannelPtr &channel, int iChannelNumber /* = 0 */)
{
const CPVRChannelGroupPtr groupAll(g_PVRChannelGroups->GetGroupAll(m_bRadio));
CSingleLock lock(m_critSection);
bool bReturn(false);
if (!CPVRChannelGroup::IsGroupMember(channel))
{
if (iChannelNumber <= 0 || iChannelNumber > (int) m_members.size() + 1)
iChannelNumber = m_members.size() + 1;
const PVRChannelGroupMember& realChannel(IsInternalGroup() ?
GetByUniqueID(channel->StorageId()) :
groupAll->GetByUniqueID(channel->StorageId()));
if (realChannel.channel)
{
PVRChannelGroupMember newMember(realChannel);
newMember.iChannelNumber = (unsigned int)iChannelNumber;
m_sortedMembers.push_back(newMember);
m_members.insert(std::make_pair(realChannel.channel->StorageId(), newMember));
m_bChanged = true;
SortAndRenumber();
//! @todo notify observers
bReturn = true;
}
}
return bReturn;
}
示例2: UpdateFromClient
CPVRChannelPtr CPVRChannelGroupInternal::UpdateFromClient(const CPVRChannelPtr &channel, const CPVRChannelNumber &channelNumber)
{
CSingleLock lock(m_critSection);
const PVRChannelGroupMember& realChannel(GetByUniqueID(channel->StorageId()));
if (realChannel.channel)
{
realChannel.channel->UpdateFromClient(channel);
return realChannel.channel;
}
else
{
unsigned int iChannelNumber = channelNumber.GetChannelNumber();
if (iChannelNumber == 0)
iChannelNumber = static_cast<int>(m_sortedMembers.size()) + 1;
PVRChannelGroupMember newMember(channel, CPVRChannelNumber(iChannelNumber, channelNumber.GetSubChannelNumber()), 0);
channel->UpdatePath(GetPath());
m_sortedMembers.push_back(newMember);
m_members.insert(std::make_pair(channel->StorageId(), newMember));
m_bChanged = true;
SortAndRenumber();
}
return channel;
}
示例3: AddToGroup
bool CPVRChannelGroup::AddToGroup(const CPVRChannelPtr &channel, const CPVRChannelNumber &channelNumber, bool bUseBackendChannelNumbers)
{
bool bReturn(false);
CSingleLock lock(m_critSection);
if (!CPVRChannelGroup::IsGroupMember(channel))
{
const PVRChannelGroupMember& realChannel(IsInternalGroup() ?
GetByUniqueID(channel->StorageId()) :
m_allChannelsGroup->GetByUniqueID(channel->StorageId()));
if (realChannel.channel)
{
unsigned int iChannelNumber = channelNumber.GetChannelNumber();
if (!channelNumber.IsValid() ||
(!bUseBackendChannelNumbers && (iChannelNumber > m_members.size() + 1)))
iChannelNumber = m_members.size() + 1;
PVRChannelGroupMember newMember(realChannel);
newMember.channelNumber = CPVRChannelNumber(iChannelNumber, channelNumber.GetSubChannelNumber());
m_sortedMembers.push_back(newMember);
m_members.insert(std::make_pair(realChannel.channel->StorageId(), newMember));
m_bChanged = true;
SortAndRenumber();
//! @todo notify observers
bReturn = true;
}
}
return bReturn;
}
示例4: lock
std::vector<CPVRChannelPtr> CPVRChannelGroup::RemoveDeletedChannels(const CPVRChannelGroup &channels)
{
std::vector<CPVRChannelPtr> removedChannels;
CSingleLock lock(m_critSection);
/* check for deleted channels */
for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end();)
{
const CPVRChannelPtr channel = (*it).channel;
if (channels.m_members.find(channel->StorageId()) == channels.m_members.end())
{
/* channel was not found */
CLog::Log(LOGINFO,"Deleted %s channel '%s' from group '%s'",
m_bRadio ? "radio" : "TV", channel->ChannelName().c_str(), GroupName().c_str());
removedChannels.emplace_back(channel);
m_members.erase(channel->StorageId());
it = m_sortedMembers.erase(it);
m_bChanged = true;
}
else
{
++it;
}
}
return removedChannels;
}
示例5: AddToGroup
bool CPVRChannelGroupInternal::AddToGroup(const CPVRChannelPtr &channel, int iChannelNumber /* = 0 */)
{
CSingleLock lock(m_critSection);
bool bReturn(false);
/* get the group member, because we need the channel ID in this group, and the channel from this group */
const PVRChannelGroupMember& groupMember(GetByUniqueID(channel->StorageId()));
if (!groupMember.channel)
return bReturn;
/* switch the hidden flag */
if (groupMember.channel->IsHidden())
{
groupMember.channel->SetHidden(false);
if (m_iHiddenChannels > 0)
m_iHiddenChannels--;
SortAndRenumber();
}
/* move this channel and persist */
bReturn = (iChannelNumber > 0l) ?
MoveChannel(groupMember.iChannelNumber, iChannelNumber, true) :
MoveChannel(groupMember.iChannelNumber, m_members.size() - m_iHiddenChannels, true);
if (m_bLoaded)
groupMember.channel->Persist();
return bReturn;
}
示例6: Get
int CPVRDatabase::Get(CPVRChannelGroup &group)
{
int iReturn = -1;
/* invalid group id */
if (group.GroupID() < 0)
{
CLog::Log(LOGERROR, "PVR - %s - invalid group id: %d", __FUNCTION__, group.GroupID());
return -1;
}
std::string strQuery = PrepareSQL("SELECT idChannel, iChannelNumber FROM map_channelgroups_channels WHERE idGroup = %u ORDER BY iChannelNumber", group.GroupID());
if (ResultQuery(strQuery))
{
iReturn = 0;
try
{
while (!m_pDS->eof())
{
int iChannelId = m_pDS->fv("idChannel").get_asInt();
int iChannelNumber = m_pDS->fv("iChannelNumber").get_asInt();
CPVRChannelPtr channel = g_PVRChannelGroups->GetGroupAll(group.IsRadio())->GetByChannelID(iChannelId);
if (channel)
{
#if PVRDB_DEBUGGING
CLog::Log(LOGDEBUG, "PVR - %s - channel '%s' loaded from the database", __FUNCTION__, channel->m_strChannelName.c_str());
#endif
PVRChannelGroupMember newMember = { channel, (unsigned int)iChannelNumber };
group.m_sortedMembers.push_back(newMember);
group.m_members.insert(std::make_pair(channel->StorageId(), newMember));
iReturn++;
}
else
{
// remove a channel that doesn't exist (anymore) from the table
Filter filter;
filter.AppendWhere(PrepareSQL("idGroup = %u", group.GroupID()));
filter.AppendWhere(PrepareSQL("idChannel = %u", iChannelId));
DeleteValues("map_channelgroups_channels", filter);
}
m_pDS->next();
}
m_pDS->close();
}
catch(...)
{
CLog::Log(LOGERROR, "PVR - %s - failed to get channels", __FUNCTION__);
}
}
if (iReturn > 0)
group.SortByChannelNumber();
return iReturn;
}
示例7: UpdateFromClient
CPVRChannelPtr CPVRChannelGroupInternal::UpdateFromClient(const CPVRChannelPtr &channel, unsigned int iChannelNumber /* = 0 */)
{
assert(channel.get());
CSingleLock lock(m_critSection);
const PVRChannelGroupMember& realChannel(GetByUniqueID(channel->StorageId()));
if (realChannel.channel)
{
realChannel.channel->UpdateFromClient(channel);
return realChannel.channel;
}
else
{
PVRChannelGroupMember newMember = { channel, iChannelNumber > 0l ? iChannelNumber : (int)m_sortedMembers.size() + 1 };
channel->UpdatePath(this);
m_sortedMembers.push_back(newMember);
m_members.insert(std::make_pair(channel->StorageId(), newMember));
m_bChanged = true;
SortAndRenumber();
}
return channel;
}
示例8: RemoveInvalidChannels
void CPVRChannelGroup::RemoveInvalidChannels(void)
{
CPVRChannelPtr channel;
CSingleLock lock(m_critSection);
for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end();)
{
bool bDelete = false;
channel = (*it).channel;
if (channel->ClientChannelNumber() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid client channel number",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
bDelete = true;
}
if (!bDelete && channel->UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid unique ID",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
bDelete = true;
}
/* remove this channel from all non-system groups if this is the internal group */
if (bDelete)
{
if (IsInternalGroup())
{
g_PVRChannelGroups->Get(m_bRadio)->RemoveFromAllGroups(channel);
channel->Delete();
}
else
{
m_members.erase(channel->StorageId());
it = m_sortedMembers.erase(it);
}
m_bChanged = true;
}
else
{
++it;
}
}
}
示例9: AddToGroup
bool CPVRChannelGroupInternal::AddToGroup(const CPVRChannelPtr &channel, const CPVRChannelNumber &channelNumber, bool bUseBackendChannelNumbers)
{
bool bReturn(false);
CSingleLock lock(m_critSection);
/* get the group member, because we need the channel ID in this group, and the channel from this group */
PVRChannelGroupMember& groupMember = GetByUniqueID(channel->StorageId());
if (!groupMember.channel)
return bReturn;
bool bSort = false;
/* switch the hidden flag */
if (groupMember.channel->IsHidden())
{
groupMember.channel->SetHidden(false);
if (m_iHiddenChannels > 0)
m_iHiddenChannels--;
bSort = true;
}
unsigned int iChannelNumber = channelNumber.GetChannelNumber();
if (!channelNumber.IsValid() ||
(!bUseBackendChannelNumbers && (iChannelNumber > m_members.size() - m_iHiddenChannels)))
iChannelNumber = m_members.size() - m_iHiddenChannels;
if (groupMember.channelNumber.GetChannelNumber() != iChannelNumber)
{
groupMember.channelNumber = CPVRChannelNumber(iChannelNumber, channelNumber.GetSubChannelNumber());
bSort = true;
}
if (bSort)
SortAndRenumber();
if (m_bLoaded)
{
bReturn = Persist();
groupMember.channel->Persist();
}
return bReturn;
}
示例10: IsGroupMember
bool CPVRChannelGroup::IsGroupMember(const CPVRChannelPtr &channel) const
{
CSingleLock lock(m_critSection);
return m_members.find(channel->StorageId()) != m_members.end();
}
示例11: GetChannelNumber
unsigned int CPVRChannelGroup::GetChannelNumber(const CPVRChannelPtr &channel) const
{
CSingleLock lock(m_critSection);
const PVRChannelGroupMember& member(GetByUniqueID(channel->StorageId()));
return member.iChannelNumber;
}
示例12: Get
int CPVRDatabase::Get(CPVRChannelGroup &results, bool bCompressDB)
{
int iReturn(0);
bool bIgnoreEpgDB = CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_EPG_IGNOREDBFORCLIENT);
std::string strQuery = PrepareSQL("SELECT channels.idChannel, channels.iUniqueId, channels.bIsRadio, channels.bIsHidden, channels.bIsUserSetIcon, channels.bIsUserSetName, "
"channels.sIconPath, channels.sChannelName, channels.bIsVirtual, channels.bEPGEnabled, channels.sEPGScraper, channels.iLastWatched, channels.iClientId, channels.bIsLocked, "
"map_channelgroups_channels.iChannelNumber, map_channelgroups_channels.iSubChannelNumber, channels.idEpg "
"FROM map_channelgroups_channels "
"LEFT JOIN channels ON channels.idChannel = map_channelgroups_channels.idChannel "
"WHERE map_channelgroups_channels.idGroup = %u", results.GroupID());
CSingleLock lock(m_critSection);
if (ResultQuery(strQuery))
{
try
{
while (!m_pDS->eof())
{
CPVRChannelPtr channel = CPVRChannelPtr(new CPVRChannel());
channel->m_iChannelId = m_pDS->fv("idChannel").get_asInt();
channel->m_iUniqueId = m_pDS->fv("iUniqueId").get_asInt();
channel->m_bIsRadio = m_pDS->fv("bIsRadio").get_asBool();
channel->m_bIsHidden = m_pDS->fv("bIsHidden").get_asBool();
channel->m_bIsUserSetIcon = m_pDS->fv("bIsUserSetIcon").get_asBool();
channel->m_bIsUserSetName = m_pDS->fv("bIsUserSetName").get_asBool();
channel->m_bIsLocked = m_pDS->fv("bIsLocked").get_asBool();
channel->m_strIconPath = m_pDS->fv("sIconPath").get_asString();
channel->m_strChannelName = m_pDS->fv("sChannelName").get_asString();
channel->m_bEPGEnabled = m_pDS->fv("bEPGEnabled").get_asBool();
channel->m_strEPGScraper = m_pDS->fv("sEPGScraper").get_asString();
channel->m_iLastWatched = static_cast<time_t>(m_pDS->fv("iLastWatched").get_asInt());
channel->m_iClientId = m_pDS->fv("iClientId").get_asInt();
channel->m_iEpgId = bIgnoreEpgDB ? -1 : m_pDS->fv("idEpg").get_asInt();
channel->UpdateEncryptionName();
PVRChannelGroupMember newMember(channel,
CPVRChannelNumber(static_cast<unsigned int>(m_pDS->fv("iChannelNumber").get_asInt()),
static_cast<unsigned int>(m_pDS->fv("iSubChannelNumber").get_asInt())),
0);
results.m_sortedMembers.emplace_back(newMember);
results.m_members.insert(std::make_pair(channel->StorageId(), newMember));
m_pDS->next();
++iReturn;
}
m_pDS->close();
}
catch (...)
{
CLog::LogF(LOGERROR, "Couldn't load channels from PVR database");
}
}
else
{
CLog::LogF(LOGERROR, "PVR database query failed");
}
m_pDS->close();
if (iReturn > 0 && bCompressDB)
Compress(true);
return iReturn;
}