本文整理汇总了C++中CPVRChannelPtr::LastWatched方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr::LastWatched方法的具体用法?C++ CPVRChannelPtr::LastWatched怎么用?C++ CPVRChannelPtr::LastWatched使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelPtr
的用法示例。
在下文中一共展示了CPVRChannelPtr::LastWatched方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLastPlayedChannel
CFileItemPtr CPVRChannelGroup::GetLastPlayedChannel(int iCurrentChannel /* = -1 */) const
{
CSingleLock lock(m_critSection);
CPVRChannelPtr returnChannel;
for (std::vector<PVRChannelGroupMember>::const_iterator it = m_members.begin(); it != m_members.end(); ++it)
{
CPVRChannelPtr channel = (*it).channel;
if (channel->ChannelID() != iCurrentChannel &&
g_PVRClients->IsConnectedClient(channel->ClientID()) &&
channel->LastWatched() > 0 &&
(!returnChannel || channel->LastWatched() > returnChannel->LastWatched()))
{
returnChannel = channel;
}
}
if (returnChannel)
{
CFileItemPtr retVal = CFileItemPtr(new CFileItem(*returnChannel));
return retVal;
}
CFileItemPtr retVal = CFileItemPtr(new CFileItem);
return retVal;
}
示例2: FilterDirectory
bool CPVRChannelGroupsContainer::FilterDirectory(const CURL &url, CFileItemList &results) const
{
if (!results.IsEmpty())
{
if (url.HasOption("view"))
{
const std::string view(url.GetOption("view"));
if (view == "lastplayed")
{
// remove channels never played so far
for (int i = 0; i < results.Size(); ++i)
{
const CPVRChannelPtr channel(results.Get(i)->GetPVRChannelInfoTag());
time_t lastWatched = channel->LastWatched();
if (!lastWatched)
{
results.Remove(i);
--i;
}
}
}
else
{
CLog::Log(LOGERROR, "CPVRChannelGroupsContainer - %s - unsupported value '%s' for url parameter 'view'", __FUNCTION__, view.c_str());
return false;
}
}
}
return true;
}
示例3: GetLastPlayedChannel
CFileItemPtr CPVRChannelGroup::GetLastPlayedChannel(unsigned int iCurrentChannel /* = -1 */) const
{
CSingleLock lock(m_critSection);
time_t tCurrentLastWatched(0), tMaxLastWatched(0);
if (iCurrentChannel > 0)
{
CPVRChannelPtr channel = GetByChannelID(iCurrentChannel);
if (channel.get())
{
CDateTime::GetCurrentDateTime().GetAsTime(tMaxLastWatched);
channel->SetLastWatched(tMaxLastWatched);
channel->Persist();
}
}
CPVRChannelPtr returnChannel;
for (unsigned int iChannelPtr = 0; iChannelPtr < m_members.size(); iChannelPtr++)
{
PVRChannelGroupMember groupMember = m_members.at(iChannelPtr);
if (g_PVRClients->IsConnectedClient(groupMember.channel->ClientID()) &&
groupMember.channel->LastWatched() > 0 &&
(tMaxLastWatched == 0 || groupMember.channel->LastWatched() < tMaxLastWatched) &&
(tCurrentLastWatched == 0 || groupMember.channel->LastWatched() > tCurrentLastWatched))
{
returnChannel = groupMember.channel;
tCurrentLastWatched = returnChannel->LastWatched();
}
}
if (returnChannel)
{
CFileItemPtr retVal = CFileItemPtr(new CFileItem(*returnChannel));
return retVal;
}
CFileItemPtr retVal = CFileItemPtr(new CFileItem);
return retVal;
}