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


C++ CPVRTimerInfoTag::SetDuration方法代码示例

本文整理汇总了C++中CPVRTimerInfoTag::SetDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRTimerInfoTag::SetDuration方法的具体用法?C++ CPVRTimerInfoTag::SetDuration怎么用?C++ CPVRTimerInfoTag::SetDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPVRTimerInfoTag的用法示例。


在下文中一共展示了CPVRTimerInfoTag::SetDuration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

CPVRTimerInfoTag *CPVRTimers::InstantTimer(CPVRChannel *channel, bool bStartTimer /* = true */)
{
  if (!channel)
  {
    if (!g_PVRManager.GetCurrentChannel(channel))
      channel = (CPVRChannel *) g_PVRChannelGroups->GetGroupAllTV()->GetFirstChannel();

    /* no channels present */
    if (!channel)
      return NULL;
  }

  const CPVREpgInfoTag *epgTag = channel->GetEPGNow();
  int iMarginEnd = g_guiSettings.GetInt("pvrrecord.marginend");
  int iPriority = g_guiSettings.GetInt("pvrrecord.defaultpriority");
  int iLifetime = g_guiSettings.GetInt("pvrrecord.defaultlifetime");
  int iDuration = g_guiSettings.GetInt("pvrrecord.instantrecordtime");

  CPVRTimerInfoTag *newTimer = epgTag ? CPVRTimerInfoTag::CreateFromEpg(*epgTag) : NULL;
  if (!newTimer)
  {
    newTimer = new CPVRTimerInfoTag;
    /* set the timer data */
    newTimer->m_iClientIndex      = -1;
    newTimer->m_bIsActive         = true;
    newTimer->m_strTitle          = channel->ChannelName();
    newTimer->m_strSummary        = g_localizeStrings.Get(19056);
    newTimer->m_iMarginEnd        = iMarginEnd ? iMarginEnd : 5; /* use 5 minutes as default */
    newTimer->m_iChannelNumber    = channel->ChannelNumber();
    newTimer->m_iClientChannelUid = channel->UniqueID();
    newTimer->m_iClientId         = channel->ClientID();
    newTimer->m_bIsRadio          = channel->IsRadio();
    newTimer->m_iPriority         = iPriority ? iPriority : 50;  /* default to 50 */
    newTimer->m_iLifetime         = iLifetime ? iLifetime : 30;  /* default to 30 days */

    /* generate summary string */
    newTimer->m_strSummary.Format("%s %s %s %s %s",
        newTimer->StartAsLocalTime().GetAsLocalizedDate(),
        g_localizeStrings.Get(19159),
        newTimer->StartAsLocalTime().GetAsLocalizedTime("", false),
        g_localizeStrings.Get(19160),
        newTimer->EndAsLocalTime().GetAsLocalizedTime("", false));
  }

  newTimer->m_iMarginStart = 0;
  newTimer->SetDuration(iDuration ? iDuration : 120); /* use 120 minutes as default */

  /* unused only for reference */
  newTimer->m_strFileNameAndPath = "pvr://timers/new";

  if (bStartTimer && !newTimer->AddToClient())
  {
    CLog::Log(LOGERROR, "PVRTimers - %s - unable to add an instant timer on the client", __FUNCTION__);
    delete newTimer;
    newTimer = NULL;
  }

  return newTimer;
}
开发者ID:,项目名称:,代码行数:59,代码来源:

示例2: CPVRTimerInfoTag

CPVRTimerInfoTag *CPVRTimerInfoTag::InstantTimer()
{
  /* create a new timer */
  CPVRTimerInfoTag *newTag = new CPVRTimerInfoTag();
  if (!newTag)
  {
    CLog::Log(LOGERROR, "%s - couldn't create new timer", __FUNCTION__);
    return NULL;
  }

  CFileItem *curPlayingChannel = g_PVRManager.GetCurrentPlayingItem();
  CPVRChannel *channel = (curPlayingChannel) ? curPlayingChannel->GetPVRChannelInfoTag(): NULL;
  if (!channel)
  {
    CLog::Log(LOGDEBUG, "%s - couldn't find current playing channel", __FUNCTION__);
    channel = PVRChannelsTV.GetByChannelNumber(1);

    if (!channel)
    {
      CLog::Log(LOGERROR, "%s - cannot find any channels",
          __FUNCTION__);
    }
  }

  int iDuration = g_guiSettings.GetInt("pvrrecord.instantrecordtime");
  if (!iDuration)
    iDuration   = 180; /* default to 180 minutes */

  int iPriority = g_guiSettings.GetInt("pvrrecord.defaultpriority");
  if (!iPriority)
    iPriority   = 50;  /* default to 50 */

  int iLifetime = g_guiSettings.GetInt("pvrrecord.defaultlifetime");
  if (!iLifetime)
    iLifetime   = 30;  /* default to 30 days */

  /* set the timer data */
  newTag->m_iClientIndex   = -1;
  newTag->m_bIsActive      = true;
  newTag->m_strTitle       = g_localizeStrings.Get(19056);
  newTag->m_iChannelNumber = channel->ChannelNumber();
  newTag->m_iClientNumber  = channel->ClientChannelNumber();
  newTag->m_iClientID      = channel->ClientID();
  newTag->m_bIsRadio       = channel->IsRadio();
  newTag->m_StartTime      = CDateTime::GetCurrentDateTime();
  newTag->SetDuration(iDuration);
  newTag->m_iPriority      = iPriority;
  newTag->m_iLifetime      = iLifetime;

  /* generate summary string */
  newTag->m_strSummary.Format("%s %s %s %s %s",
      newTag->m_StartTime.GetAsLocalizedDate(),
      g_localizeStrings.Get(19159),
      newTag->m_StartTime.GetAsLocalizedTime("", false),
      g_localizeStrings.Get(19160),
      newTag->m_StopTime.GetAsLocalizedTime("", false));

  /* unused only for reference */
  newTag->m_strFileNameAndPath = "pvr://timers/new";

  return newTag;
}
开发者ID:,项目名称:,代码行数:62,代码来源:


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