当前位置: 首页>>代码示例>>C++>>正文


C++ CPVRChannelPtr::LastWatched方法代码示例

本文整理汇总了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;
}
开发者ID:Dr-Romantic,项目名称:xbmc,代码行数:26,代码来源:PVRChannelGroup.cpp

示例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;
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:30,代码来源:PVRChannelGroupsContainer.cpp

示例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;
}
开发者ID:gaiyangjun,项目名称:xbmc,代码行数:40,代码来源:PVRChannelGroup.cpp


注:本文中的CPVRChannelPtr::LastWatched方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。