示例#1
0
bool CGUIWindowPVRSearch::OnContextButton(const CFileItem &item, CONTEXT_BUTTON button)
{
  bool bReturn = false;

  switch(button)
  {
    case CONTEXT_BUTTON_FIND:
    {
      m_searchfilter.Reset();

      // construct the search term
      if (item.IsEPG())
        m_searchfilter.m_strSearchTerm = "\"" + item.GetEPGInfoTag()->Title() + "\"";
      else if (item.IsPVRChannel())
      {
        CEpgInfoTagPtr tag(item.GetPVRChannelInfoTag()->GetEPGNow());
        if (tag)
          m_searchfilter.m_strSearchTerm = "\"" + tag->Title() + "\"";
      }
      else if (item.IsUsablePVRRecording())
        m_searchfilter.m_strSearchTerm = "\"" + item.GetPVRRecordingInfoTag()->m_strTitle + "\"";
      else if (item.IsPVRTimer())
        m_searchfilter.m_strSearchTerm = "\"" + item.GetPVRTimerInfoTag()->m_strTitle + "\"";

      m_bSearchConfirmed = true;
      Refresh(true);
      bReturn = true;
      break;
    }
    default:
      bReturn = false;
  }

  return bReturn;
}
示例#2
0
CPVRClientPtr CPVRManager::GetClient(const CFileItem &item) const
{
  int iClientID = PVR_INVALID_CLIENT_ID;

  if (item.HasPVRChannelInfoTag())
    iClientID = item.GetPVRChannelInfoTag()->ClientID();
  else if (item.HasPVRRecordingInfoTag())
    iClientID = item.GetPVRRecordingInfoTag()->m_iClientId;
  else if (item.HasPVRTimerInfoTag())
    iClientID = item.GetPVRTimerInfoTag()->m_iClientId;
  else if (item.HasEPGInfoTag())
    iClientID = item.GetEPGInfoTag()->ClientID();
  else if (URIUtils::IsPVRChannel(item.GetPath()))
  {
    const std::shared_ptr<CFileItem> channelItem = m_channelGroups->GetByPath(item.GetPath());
    if (channelItem)
      iClientID = channelItem->GetPVRChannelInfoTag()->ClientID();
  }
  else if (URIUtils::IsPVRRecording(item.GetPath()))
  {
    const std::shared_ptr<CFileItem> recordingItem = m_recordings->GetByPath(item.GetPath());
    if (recordingItem)
      iClientID = recordingItem->GetPVRRecordingInfoTag()->ClientID();
  }
  return GetClient(iClientID);
}
示例#3
0
CPVRClientPtr CPVRManager::GetClient(const CFileItem &item) const
{
  int iClientID = PVR_INVALID_CLIENT_ID;

  if (item.HasPVRChannelInfoTag())
    iClientID = item.GetPVRChannelInfoTag()->ClientID();
  else if (item.HasPVRRecordingInfoTag())
    iClientID = item.GetPVRRecordingInfoTag()->m_iClientId;
  else if (item.HasPVRTimerInfoTag())
    iClientID = item.GetPVRTimerInfoTag()->m_iClientId;
  else if (item.HasEPGInfoTag())
    iClientID = item.GetEPGInfoTag()->ClientID();

  return GetClient(iClientID);
}
示例#4
0
bool CGUIWindowPVRBase::StopRecordFile(const CFileItem &item)
{
  if (!item.HasEPGInfoTag())
    return false;

  const CEpgInfoTagPtr tag(item.GetEPGInfoTag());
  if (!tag || !tag->HasPVRChannel())
    return false;

  CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(&item);
  if (!timer || !timer->HasPVRTimerInfoTag() || timer->GetPVRTimerInfoTag()->m_bIsRepeating)
    return false;

  return g_PVRTimers->DeleteTimer(*timer);
}
bool CGUIWindowPVRBase::StartRecordFile(const CFileItem &item)
{
    if (!item.HasEPGInfoTag())
        return false;

    const CEpgInfoTag *tag = item.GetEPGInfoTag();
    CPVRChannelPtr channel;
    if (tag)
        channel = tag->ChannelTag();

    if (!channel || !g_PVRManager.CheckParentalLock(*channel))
        return false;

    CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(&item);
    if (timer && timer->HasPVRTimerInfoTag())
    {
        CGUIDialogOK::ShowAndGetInput(19033,19034,0,0);
        return false;
    }

    // ask for confirmation before starting a timer
    CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
    if (!pDialog)
        return false;
    pDialog->SetHeading(264);
    pDialog->SetLine(0, tag->PVRChannelName());
    pDialog->SetLine(1, "");
    pDialog->SetLine(2, tag->Title());
    pDialog->DoModal();

    if (!pDialog->IsConfirmed())
        return false;

    CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*tag);
    bool bReturn(false);
    if (newTimer)
    {
        bReturn = g_PVRTimers->AddTimer(*newTimer);
        delete newTimer;
    }
    return bReturn;
}