Exemplo n.º 1
0
void CPVRRecordings::UpdateFromClient(const CPVRRecordingPtr &tag)
{
  CSingleLock lock(m_critSection);

  if (tag->IsDeleted())
    m_bHasDeleted = true;

  CPVRRecordingPtr newTag = GetById(tag->m_iClientId, tag->m_strRecordingId);
  if (newTag)
  {
    newTag->Update(*tag);
  }
  else
  {
    newTag = CPVRRecordingPtr(new CPVRRecording);
    newTag->Update(*tag);
    if (newTag->BroadcastUid() != EPG_TAG_INVALID_UID)
    {
      const CPVRChannelPtr channel(newTag->Channel());
      if (channel)
      {
        const EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::GetInstance().GetTagById(channel, newTag->BroadcastUid());
        if (epgTag)
          epgTag->SetRecording(newTag);
      }
    }
    newTag->m_iRecordingId = ++m_iLastId;
    m_recordings.insert(std::make_pair(CPVRRecordingUid(newTag->m_iClientId, newTag->m_strRecordingId), newTag));
  }
}
Exemplo n.º 2
0
CPVRRecordingPtr CPVRChannel::GetRecording(void) const
{
  EPG::CEpgInfoTagPtr epgTag = GetEPGNow();
  return (epgTag && epgTag->HasRecording()) ?
      epgTag->Recording() :
      CPVRRecordingPtr();
}
Exemplo n.º 3
0
void CPVRRecordings::UpdateFromClient(const CPVRRecordingPtr &tag)
{
  CSingleLock lock(m_critSection);

  if (tag->IsDeleted())
    m_bHasDeleted = true;

  CPVRRecordingPtr newTag = GetById(tag->m_iClientId, tag->m_strRecordingId);
  if (newTag)
  {
    newTag->Update(*tag);
  }
  else
  {
    newTag = CPVRRecordingPtr(new CPVRRecording);
    newTag->Update(*tag);
    if (newTag->EpgEvent() > 0)
    {
      EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::GetInstance().GetTagById(newTag->EpgEvent());
      if (epgTag)
        epgTag->SetRecording(newTag);
    }
    newTag->m_iRecordingId = ++m_iLastId;
    m_recordings.insert(std::make_pair(CPVRRecordingUid(newTag->m_iClientId, newTag->m_strRecordingId), newTag));
  }
}
Exemplo n.º 4
0
bool CPVRRecording::IsBeingRecorded(void) const
{
  if (m_iEpgEventId)
  {
    EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::GetInstance().GetTagById(m_iEpgEventId);
    return epgTag ? epgTag->HasRecording() : false;
  }
  return false;
}
Exemplo n.º 5
0
CPVRChannelPtr CPVRRecording::Channel(void) const
{
  if (m_iEpgEventId)
  {
    EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::GetInstance().GetTagById(m_iEpgEventId);
    if (epgTag)
      return epgTag->ChannelTag();
  }
  return CPVRChannelPtr();
}
Exemplo n.º 6
0
void CPVRRecording::OnDelete(void)
{
  if (m_iEpgEventId != EPG_TAG_INVALID_UID)
  {
    const CPVRChannelPtr channel(Channel());
    if (channel)
    {
      const EPG::CEpgInfoTagPtr epgTag(EPG::CEpgContainer::GetInstance().GetTagById(channel, m_iEpgEventId));
      if (epgTag)
        epgTag->ClearRecording();
    }
  }
}
Exemplo n.º 7
0
void CPVRRecordings::UpdateEpgTags(void)
{
  CSingleLock lock(m_critSection);
  int iEpgEvent;
  for (PVR_RECORDINGMAP_ITR it = m_recordings.begin(); it != m_recordings.end(); ++it)
  {
    iEpgEvent = it->second->EpgEvent();
    if (iEpgEvent > 0 && !it->second->IsDeleted())
    {
      EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::GetInstance().GetTagById(iEpgEvent);
      if (epgTag)
        epgTag->SetRecording(it->second);
    }
  }
}
Exemplo n.º 8
0
void CGUIDialogPVRTimerSettings::InitializeTypesList()
{
  m_typeEntries.clear();

  // If timer is read-only or was created by a timer rule, only add current type, for information. Type can't be changed.
  if (m_timerType->IsReadOnly() || m_timerInfoTag->GetTimerRuleId() != PVR_TIMER_NO_PARENT)
  {
    m_typeEntries.insert(std::make_pair(0, m_timerType));
    return;
  }

  int idx = 0;
  const std::vector<CPVRTimerTypePtr> types(CPVRTimerType::GetAllTypes());
  for (const auto &type : types)
  {
    // Type definition prohibits created of new instances.
    // But the dialog can act as a viewer for these types.
    if (type->ForbidsNewInstances())
      continue;

    // Read-only timers cannot be created using this dialog.
    // But the dialog can act as a viewer for read-only types.
    if (type->IsReadOnly())
      continue;

    // Drop TimerTypes that require EPGInfo, if none is populated
    if (type->RequiresEpgTagOnCreate() && !m_timerInfoTag->GetEpgInfoTag())
      continue;

    // Drop TimerTypes without 'Series' EPG attributes if none are set
    if (type->RequiresEpgSeriesOnCreate())
    {
      const EPG::CEpgInfoTagPtr epgTag(m_timerInfoTag->GetEpgInfoTag());
      if (epgTag && !epgTag->IsSeries())
        continue;
    }

    // Drop TimerTypes that forbid EPGInfo, if it is populated
    if (type->ForbidsEpgTagOnCreate() && m_timerInfoTag->GetEpgInfoTag())
      continue;

    // Drop TimerTypes that aren't rules if end time is in the past
    if (!type->IsTimerRule() && m_timerInfoTag->EndAsLocalTime() < CDateTime::GetCurrentDateTime())
      continue;

    m_typeEntries.insert(std::make_pair(idx++, type));
  }
}
Exemplo n.º 9
0
void CPVRRecordings::UpdateEpgTags(void)
{
  CSingleLock lock(m_critSection);
  unsigned int iEpgEvent;
  CPVRChannelPtr channel;
  for (PVR_RECORDINGMAP_ITR it = m_recordings.begin(); it != m_recordings.end(); ++it)
  {
    iEpgEvent = it->second->BroadcastUid();
    if (iEpgEvent != EPG_TAG_INVALID_UID && !it->second->IsDeleted())
    {
      channel = it->second->Channel();
      if (channel)
      {
        const EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::GetInstance().GetTagById(channel, iEpgEvent);
        if (epgTag)
          epgTag->SetRecording(it->second);
      }
    }
  }
}
Exemplo n.º 10
0
CPVRRecordingPtr CPVRRecordings::GetRecordingForEpgTag(const EPG::CEpgInfoTagPtr &epgTag) const
{
  CSingleLock lock(m_critSection);

  for (const auto recording : m_recordings)
  {
    if (recording.second->IsDeleted())
      continue;

    unsigned int iEpgEvent = recording.second->BroadcastUid();
    if (iEpgEvent != EPG_TAG_INVALID_UID)
    {
      if (iEpgEvent == epgTag->UniqueBroadcastID())
      {
        // uid matches. perfect.
        return recording.second;
      }
    }
    else
    {
      // uid is optional, so check other relevant data.

      // note: don't use recording.second->Channel() for comparing channels here as this can lead
      //       to deadlocks. compare client ids and channel ids instead, this has the same effect.
      if (epgTag->ChannelTag() &&
          recording.second->ClientID() == epgTag->ChannelTag()->ClientID() &&
          recording.second->ChannelUid() == epgTag->ChannelTag()->UniqueID() &&
          recording.second->RecordingTimeAsUTC() <= epgTag->StartAsUTC() &&
          (recording.second->RecordingTimeAsUTC() + recording.second->m_duration) >= epgTag->EndAsUTC())
        return recording.second;
    }
  }

  return CPVRRecordingPtr();
}
Exemplo n.º 11
0
bool CPVRChannel::HasRecording(void) const
{
  EPG::CEpgInfoTagPtr epgTag = GetEPGNow();
  return epgTag && epgTag->HasRecording();
}
Exemplo n.º 12
0
void CPVRRecording::OnDelete(void)
{
  EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::GetInstance().GetTagById(EpgEvent());
  if (epgTag)
    epgTag->ClearRecording();
}