示例#1
0
void CPVREpgContainer::Clear(bool bClearDb /* = false */)
{
  CSingleLock lock(m_critSection);
  // XXX stop the timers from being updated while clearing tags
  /* remove all pointers to epg tables on timers */
  CPVRTimers *timers = CPVRManager::GetTimers();
  for (unsigned int iTimerPtr = 0; iTimerPtr < timers->size(); iTimerPtr++)
    timers->at(iTimerPtr)->SetEpgInfoTag(NULL);

  CEpgContainer::Clear(bClearDb);
}
示例#2
0
int CPVREpgContainer::GetEPGSearch(CFileItemList* results, const PVREpgSearchFilter &filter)
{
  CEpgContainer::GetEPGSearch(results, filter);

  /* filter recordings */
  if (filter.m_bIgnorePresentRecordings && CPVRManager::GetRecordings()->size() > 0)
  {
    for (unsigned int iRecordingPtr = 0; iRecordingPtr < CPVRManager::GetRecordings()->size(); iRecordingPtr++)
    {
      for (int iResultPtr = 0; iResultPtr < results->Size(); iResultPtr++)
      {
        const CPVREpgInfoTag *epgentry  = (CPVREpgInfoTag *) results->Get(iResultPtr)->GetEPGInfoTag();
        CPVRRecording *recording = CPVRManager::GetRecordings()->at(iRecordingPtr);
        if (epgentry)
        {
          if (epgentry->Title()       != recording->m_strTitle ||
              epgentry->PlotOutline() != recording->m_strPlotOutline ||
              epgentry->Plot()        != recording->m_strPlot)
            continue;

          results->Remove(iResultPtr);
          iResultPtr--;
        }
      }
    }
  }

  /* filter timers */
  if (filter.m_bIgnorePresentTimers)
  {
    CPVRTimers *timers = CPVRManager::GetTimers();
    for (unsigned int iTimerPtr = 0; iTimerPtr < timers->size(); iTimerPtr++)
    {
      for (int iResultPtr = 0; iResultPtr < results->Size(); iResultPtr++)
      {
        const CPVREpgInfoTag *epgentry = (CPVREpgInfoTag *) results->Get(iResultPtr)->GetEPGInfoTag();
        CPVRTimerInfoTag *timer        = timers->at(iTimerPtr);
        if (epgentry)
        {
          if (epgentry->ChannelTag()->ChannelNumber() != timer->ChannelNumber() ||
              epgentry->Start()                       <  timer->m_StartTime ||
              epgentry->End()                         >  timer->m_StopTime)
            continue;

          results->Remove(iResultPtr);
          iResultPtr--;
        }
      }
    }
  }

  return results->Size();
}
bool CPVRChannelGroupInternal::UpdateTimers(void)
{
  /* update the timers with the new channel numbers */
  CPVRTimers *timers = CPVRManager::GetTimers();
  for (unsigned int ptr = 0; ptr < timers->size(); ptr++)
  {
    CPVRTimerInfoTag *timer = timers->at(ptr);
    const CPVRChannel *tag = GetByClient(timer->Number(), timer->ClientID());
    if (tag)
      timer->SetNumber(tag->ChannelNumber());
  }

  return true;
}
示例#4
0
bool CPVRChannelGroupInternal::UpdateTimers(void)
{
  CSingleLock lock(m_critSection);

  /* update the timers with the new channel numbers */
  CPVRTimers *timers = g_PVRTimers;
  for (unsigned int ptr = 0; ptr < timers->size(); ptr++)
  {
    CPVRTimerInfoTag *timer = timers->at(ptr);
    const CPVRChannel *tag = GetByClient(timer->m_iClientChannelUid, timer->m_iClientId);
    if (tag)
      timer->m_channel = tag;
  }

  return true;
}
示例#5
0
void CEpgContainer::Clear(bool bClearDb /* = false */)
{
  /* make sure the update thread is stopped */
  bool bThreadRunning = !m_bStop;
  if (bThreadRunning && !Stop())
  {
    CLog::Log(LOGERROR, "%s - cannot stop the update thread", __FUNCTION__);
    return;
  }

  if (g_PVRManager.IsStarted())
  {
    // XXX stop the timers from being updated while clearing tags
    /* remove all pointers to epg tables on timers */
    CPVRTimers *timers = g_PVRTimers;
    for (unsigned int iTimerPtr = 0; timers != NULL && iTimerPtr < timers->size(); iTimerPtr++)
      timers->at(iTimerPtr)->SetEpgInfoTag(NULL);
  }

  {
    CSingleLock lock(m_critSection);
    /* clear all epg tables and remove pointers to epg tables on channels */
    for (unsigned int iEpgPtr = 0; iEpgPtr < m_epgs.size(); iEpgPtr++)
      delete m_epgs[iEpgPtr];
    m_epgs.clear();
    m_iNextEpgUpdate  = 0;
    m_bIsInitialising = true;
  }

  /* clear the database entries */
  if (bClearDb && !m_bIgnoreDbForClient)
  {
    if (m_database.Open())
    {
      m_database.DeleteEpg();
      m_database.Close();
    }
  }

  SetChanged();
  NotifyObservers("epg", true);

  if (bThreadRunning)
    Start();
}
示例#6
0
bool CPVREpgInfoTag::HasTimer(void) const
{
  bool bReturn = false;

  if (m_Timer == NULL)
  {
    CPVRTimers *timers = CPVRManager::GetTimers();
    for (unsigned int iTimerPtr = 0; iTimerPtr < timers->size(); iTimerPtr++)
    {
      if (timers->at(iTimerPtr)->EpgInfoTag() == this)
      {
        bReturn = true;
        break;
      }
    }
  }
  else
  {
    bReturn = true;
  }

  return bReturn;
}