Ejemplo n.º 1
0
bool CPVRChannelGroups::DeleteGroup(const CPVRChannelGroup &group)
{
  // don't delete internal groups
  if (group.IsInternalGroup())
  {
    CLog::Log(LOGERROR, "CPVRChannelGroups - %s - cannot delete internal group '%s'", __FUNCTION__, group.GroupName().c_str());
    return false;
  }

  bool bFound(false);
  CPVRChannelGroupPtr playingGroup;

  // delete the group in this container
  {
    CSingleLock lock(m_critSection);
    for (std::vector<CPVRChannelGroupPtr>::iterator it = m_groups.begin(); !bFound && it != m_groups.end();)
    {
      if (*(*it) == group || (group.GroupID() > 0 && (*it)->GroupID() == group.GroupID()))
      {
        // update the selected group in the gui if it's deleted
        CPVRChannelGroupPtr selectedGroup = GetSelectedGroup();
        if (selectedGroup && *selectedGroup == group)
          playingGroup = GetGroupAll();

        it = m_groups.erase(it);
        bFound = true;
      }
      else
      {
        ++it;
      }
    }
  }

  if (playingGroup)
    g_PVRManager.SetPlayingGroup(playingGroup);

  if (group.GroupID() > 0)
  {
    // delete the group from the database
    const CPVRDatabasePtr database(g_PVRManager.GetTVDatabase());
    return database ? database->Delete(group) : false;
  }
  return bFound;
}
Ejemplo n.º 2
0
bool CPVRChannel::Delete(void)
{
  bool bReturn = false;
  const CPVRDatabasePtr database = CServiceBroker::GetPVRManager().GetTVDatabase();
  if (!database)
    return bReturn;

  const CPVREpgPtr epg = GetEPG();
  if (epg)
  {
    CServiceBroker::GetPVRManager().EpgContainer().DeleteEpg(epg, true);

    CSingleLock lock(m_critSection);
    m_epg.reset();
  }

  bReturn = database->Delete(*this);
  return bReturn;
}
Ejemplo n.º 3
0
bool CPVRChannel::Delete(void)
{
  bool bReturn = false;
  const CPVRDatabasePtr database(g_PVRManager.GetTVDatabase());
  if (!database)
    return bReturn;

  /* delete the EPG table */
  CEpgPtr epg = GetEPG();
  if (epg)
  {
    CPVRChannelPtr empty;
    epg->SetChannel(empty);
    g_EpgContainer.DeleteEpg(*epg, true);
    CSingleLock lock(m_critSection);
    m_bEPGCreated = false;
  }

  bReturn = database->Delete(*this);
  return bReturn;
}