Example #1
0
bool CPVREpgs::RemoveOldEntries()
{
  bool bReturn = false;
  CLog::Log(LOGINFO, "PVREpgs - %s - removing old EPG entries",
      __FUNCTION__);

  CPVRDatabase *database = g_PVRManager.GetTVDatabase();
  CDateTime now = CDateTime::GetCurrentDateTime();

  if (!database->Open())
  {
    CLog::Log(LOGERROR, "PVREpgs - %s - cannot open the database",
        __FUNCTION__);
    return bReturn;
  }

  /* call Cleanup() on all known EPG tables */
  for (unsigned int iEpgPtr = 0; iEpgPtr < size(); iEpgPtr++)
  {
    at(iEpgPtr)->Cleanup(now);
  }

  /* remove the old entries from the database */
  bReturn = database->EraseOldEpgEntries();

  if (bReturn)
    CDateTime::GetCurrentDateTime().GetAsTime(m_iLastEpgCleanup);

  return bReturn;
}