当前位置: 首页>>代码示例>>C++>>正文


C++ CPVRDatabase::Open方法代码示例

本文整理汇总了C++中CPVRDatabase::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRDatabase::Open方法的具体用法?C++ CPVRDatabase::Open怎么用?C++ CPVRDatabase::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPVRDatabase的用法示例。


在下文中一共展示了CPVRDatabase::Open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RemoveOldEntries

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;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:30,代码来源:PVREpgs.cpp

示例2: Clear

void CPVREpgs::Clear(bool bClearDb /* = false */)
{
  /* remove all pointers to epg tables on timers */
  for (unsigned int iTimerPtr = 0; iTimerPtr < PVRTimers.size(); iTimerPtr++)
    PVRTimers[iTimerPtr].SetEpgInfoTag(NULL);

  /* clear all epg tables and remove pointers to epg tables on channels */
  for (unsigned int iEpgPtr = 0; iEpgPtr < size(); iEpgPtr++)
  {
    CPVREpg *epg = at(iEpgPtr);
    epg->Clear();

    CPVRChannel *channel = (CPVRChannel *) epg->Channel();
    if (channel)
      channel->m_EPG = NULL;
  }

  /* remove all EPG tables */
  clear();

  /* clear the database entries */
  if (bClearDb)
  {
    CPVRDatabase *database = g_PVRManager.GetTVDatabase();
    database->Open();
    database->EraseEpg();
    database->Close();
  }

  m_iLastEpgUpdate  = 0;
  m_bDatabaseLoaded = false;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:32,代码来源:PVREpgs.cpp

示例3: LoadFromClients

int CPVRChannels::LoadFromClients(bool bAddToDb /* = true */)
{
  CPVRDatabase *database = NULL;
  int iCurSize = size();

  if (bAddToDb)
  {
    database = g_PVRManager.GetTVDatabase();

    if (!database || !database->Open())
      return -1;
  }

  if (GetFromClients() == -1)
    return -1;

  SortByClientChannelNumber();
  ReNumberAndCheck();
  SearchAndSetChannelIcons();

  if (bAddToDb)
  {
    /* add all channels to the database */
    for (unsigned int ptr = 0; ptr < size(); ptr++)
      database->UpdateChannel(*at(ptr));

    database->Close();

    clear();

    return LoadFromDb(true);
  }

  return size() - iCurSize;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:35,代码来源:PVRChannels.cpp

示例4: LoadFromDb

int CPVRChannelGroupInternal::LoadFromDb(bool bCompress /* = false */)
{
  CPVRDatabase *database = g_PVRManager.GetTVDatabase();
  if (!database || !database->Open())
    return -1;

  int iChannelCount = size();

  if (database->GetChannels(this, m_bRadio) > 0)
  {
    if (bCompress)
      database->Compress(true);
  }
  else
  {
    CLog::Log(LOGINFO, "PVRChannelGroupInternal - %s - no channels in the database",
        __FUNCTION__);
  }

  database->Close();

  SortByChannelNumber();

  return size() - iChannelCount;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例5: Load

bool CPVRChannelGroups::Load(void)
{
    CLog::Log(LOGDEBUG, "PVRChannelGroups - %s - loading all %s channel groups",
              __FUNCTION__, m_bRadio ? "radio" : "TV");

    Clear();

    /* create internal channel group */
    CPVRChannelGroupInternal *internalChannels = new CPVRChannelGroupInternal(m_bRadio);
    push_back(internalChannels);
    internalChannels->Load();

    /* load the other groups from the database */
    CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
    if (database->Open())
    {
        database->GetChannelGroupList(*this, m_bRadio);

        /* load group members */
        for (unsigned int iGroupPtr = 1; iGroupPtr < size(); iGroupPtr++)
            at(iGroupPtr)->Load();

        database->Close();
    }

    CLog::Log(LOGDEBUG, "PVRChannelGroups - %s - %d %s channel groups loaded",
              __FUNCTION__, size(), m_bRadio ? "radio" : "TV");

    return true;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例6: LoadFromDb

bool CPVREpgs::LoadFromDb(bool bShowProgress /* = false */)
{
  if (m_bDatabaseLoaded)
    return m_bDatabaseLoaded;

  CPVRDatabase *database = g_PVRManager.GetTVDatabase();

  /* show the progress bar */
  CGUIDialogPVRUpdateProgressBar *scanner = NULL;
  if (bShowProgress)
  {
    scanner = (CGUIDialogPVRUpdateProgressBar *)g_windowManager.GetWindow(WINDOW_DIALOG_EPG_SCAN);
    scanner->Show();
    scanner->SetHeader(g_localizeStrings.Get(19004));
  }

  /* open the database */
  database->Open();

  /* load all EPG tables */
  bool bLoaded = false;
  unsigned int iSize = size();
  for (unsigned int iEpgPtr = 0; iEpgPtr < iSize; iEpgPtr++)
  {
    CPVREpg *epg = at(iEpgPtr);
    CPVRChannel *channel = epg->Channel();

    if (epg->LoadFromDb())
    {
      if (channel)
        channel->UpdateEPGPointers();

      bLoaded = true;
    }

    if (bShowProgress)
    {
      /* update the progress bar */
      if (channel)
        scanner->SetTitle(channel->ChannelName());

      scanner->SetProgress(iEpgPtr, iSize);
      scanner->UpdateState();
    }
  }

  /* close the database */
  database->Close();

  if (bShowProgress)
    scanner->Close();

  m_bDatabaseLoaded = bLoaded;

  return bLoaded;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:56,代码来源:PVREpgs.cpp

示例7: Persist

bool CPVRChannelGroupInternal::Persist(void)
{
  bool bReturn(true);
  CSingleLock lock(m_critSection);

  bool bHasNewChannels = HasNewChannels();
  bool bHasChangedChannels = HasChangedChannels();

  if (bHasNewChannels || bHasChangedChannels)
  CLog::Log(LOGDEBUG, "CPVRChannelGroupInternal - %s - persisting %d channels",
      __FUNCTION__, (int) size());

  if (bHasNewChannels)
  {
    CLog::Log(LOGDEBUG, "CPVRChannelGroupInternal - %s - group '%s' has new channels. writing changes directly",
        __FUNCTION__, GroupName().c_str());
    /* write directly to get channel ids */
    for (unsigned int iChannelPtr = 0; iChannelPtr < size(); iChannelPtr++)
    {
      if (!at(iChannelPtr).channel->Persist())
      {
        CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to persist channel '%s'",
            __FUNCTION__, at(iChannelPtr).channel->ChannelName().c_str());
        bReturn = false;
      }
    }
  }
  else if (bHasChangedChannels)
  {
    /* open the database */
    CPVRDatabase *database = g_PVRManager.GetTVDatabase();
    if (!database || !database->Open())
    {
      CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to open the database", __FUNCTION__);
      return false;
    }

    /* queue queries */
    for (unsigned int iChannelPtr = 0; iChannelPtr < size(); iChannelPtr++)
      at(iChannelPtr).channel->Persist(true);

    /* and commit them */
    bReturn = database->CommitInsertQueries();
    if (!bReturn)
      CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to persist channels", __FUNCTION__);

    database->Close();
  }

  if (bReturn)
    bReturn = CPVRChannelGroup::Persist();

  return bReturn;
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例8: Update

bool CPVRChannelGroupInternal::Update()
{
  bool          bReturn  = false;
  CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();

  if (database && database->Open())
  {
    CPVRChannelGroupInternal PVRChannels_tmp(m_bRadio);

    PVRChannels_tmp.LoadFromClients(false);
    bReturn = UpdateGroupEntries(&PVRChannels_tmp);

    database->Close();
  }

  return bReturn;
}
开发者ID:vanegithub,项目名称:xbmc,代码行数:17,代码来源:PVRChannelGroupInternal.cpp

示例9: Update

bool CPVRChannels::Update()
{
  bool         bReturn  = false;
  CPVRDatabase *database = g_PVRManager.GetTVDatabase();

  if (database && database->Open())
  {
    CPVRChannels PVRChannels_tmp(m_bRadio);

    PVRChannels_tmp.LoadFromClients(false);
    bReturn = Update(&PVRChannels_tmp);

    database->Close();
  }

  return bReturn;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:17,代码来源:PVRChannels.cpp

示例10: MoveChannel

void CPVRChannels::MoveChannel(unsigned int iOldIndex, unsigned int iNewIndex)
{
  if (iNewIndex == iOldIndex || iNewIndex == 0)
    return;

  CPVRDatabase *database = g_PVRManager.GetTVDatabase();
  database->Open();

  CPVRChannels tempChannels(m_bRadio);

  /* move the channel */
  tempChannels.push_back(at(iOldIndex - 1));
  erase(begin() + iOldIndex - 1);
  if (iNewIndex < size())
    insert(begin() + iNewIndex - 1, tempChannels[0]);
  else
    push_back(tempChannels[0]);

  /* update the channel numbers */
  for (unsigned int ptr = 0; ptr < size(); ptr++)
  {
    CPVRChannel *channel = at(ptr);

    if (channel->ChannelNumber() != (int) ptr + 1)
    {
      channel->SetChannelNumber(ptr + 1, true);
    }
  }

  CLog::Log(LOGNOTICE, "%s - %s channel '%d' moved to '%d'",
      __FUNCTION__, (m_bRadio ? "radio" : "tv"), iOldIndex, iNewIndex);

  database->Close();

  /* update the timers with the new channel numbers */
  for (unsigned int ptr = 0; ptr < PVRTimers.size(); ptr++)
  {
    CPVRTimerInfoTag timer = PVRTimers[ptr];
    CPVRChannel *tag = GetByClient(timer.Number(), timer.ClientID());
    if (tag)
      timer.SetNumber(tag->ChannelNumber());
  }

  m_bIsSorted = false;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:45,代码来源:PVRChannels.cpp

示例11: Process

void CPVREpgs::Process()
{
  time_t iNow          = 0;
  m_iLastPointerUpdate = 0;
  m_iLastTimerUpdate   = 0;
  m_iLastEpgCleanup    = 0;
  m_iLastEpgUpdate     = 0;

  CPVRDatabase *database = g_PVRManager.GetTVDatabase();
  if (!database->Open())
  {
    CLog::Log(LOGERROR, "PVREpgs - %s - cannot open the database",
        __FUNCTION__);
    return;
  }

  /* get the last EPG update time from the database */
  database->GetLastEpgScanTime().GetAsTime(m_iLastEpgUpdate);
  database->Close();

  LoadSettings();

  while (!m_bStop)
  {
    CDateTime::GetCurrentDateTime().GetAsTime(iNow);

    /* update the EPG */
    if (!m_bStop && (iNow > m_iLastEpgUpdate + m_iUpdateTime || !m_bDatabaseLoaded))
      UpdateEPG(!m_bDatabaseLoaded);

    /* update the "now playing" pointers every 60 seconds */
    if (!m_bStop && iNow > m_iLastPointerUpdate + 60)
      UpdateAllChannelEPGPointers();

    /* update the timers every 60 seconds */
    if (!m_bStop && iNow > m_iLastTimerUpdate + 60)
      UpdateTimers();

    /* remove old entries every 30 minutes */
    if (!m_bStop && iNow > m_iLastEpgCleanup + 1800)
      RemoveOldEntries();

    Sleep(1000);
  }
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:45,代码来源:PVREpgs.cpp

示例12: SearchAndSetChannelIcons

void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
  if (g_guiSettings.GetString("pvrmenu.iconpath") == "")
    return;

  CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
  database->Open();
  CSingleLock lock(m_critSection);

  for (unsigned int ptr = 0; ptr < size(); ptr++)
  {
    PVRChannelGroupMember groupMember = at(ptr);

    /* skip if an icon is already set */
    if (groupMember.channel->IconPath() != "")
      continue;

    CStdString strBasePath = g_guiSettings.GetString("pvrmenu.iconpath");
    CStdString strChannelName = groupMember.channel->ClientChannelName();

    CStdString strIconPath = strBasePath + groupMember.channel->ClientChannelName();
    CStdString strIconPathLower = strBasePath + strChannelName.ToLower();
    CStdString strIconPathUid;
    strIconPathUid.Format("%s/%08d", strBasePath, groupMember.channel->UniqueID());

    groupMember.channel->SetIconPath(strIconPath      + ".tbn", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPath      + ".jpg", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPath      + ".png", bUpdateDb) ||

    groupMember.channel->SetIconPath(strIconPathLower + ".tbn", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathLower + ".jpg", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathLower + ".png", bUpdateDb) ||

    groupMember.channel->SetIconPath(strIconPathUid   + ".tbn", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathUid   + ".jpg", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathUid   + ".png", bUpdateDb);

    /* TODO: start channel icon scraper here if nothing was found */
  }

  database->Close();
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例13: LoadFromDb

int CPVRChannels::LoadFromDb(bool bCompress /* = false */)
{
  CPVRDatabase *database = g_PVRManager.GetTVDatabase();
  if (!database || !database->Open())
    return -1;

  int iChannelCount = size();

  if (database->GetChannels(*this, m_bRadio) > 0)
  {
    if (bCompress)
      database->Compress(true);

    Update();
  }

  database->Close();

  return size() - iChannelCount;
}
开发者ID:margro,项目名称:xbmc-antiquated,代码行数:20,代码来源:PVRChannels.cpp

示例14: Delete

bool CPVRChannel::Delete(void)
{
  bool bReturn = false;
  CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
  if (!database || !database->Open())
    return bReturn;

  /* delete the EPG table */
  if (m_EPG)
  {
    CPVRManager::GetEpg()->DeleteEpg(*m_EPG, true);
    m_EPG = NULL;
  }

  bReturn = database->Delete(*this);

  database->Close();

  return bReturn;
}
开发者ID:rdaoc,项目名称:xbmc,代码行数:20,代码来源:PVRChannel.cpp

示例15: Persist

bool CPVRChannel::Persist(bool bQueueWrite /* = false */)
{
  CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
  if (database)
  {
    if (!bQueueWrite)
    {
      database->Open();
      m_iChannelId = database->Persist(*this, false);
      database->Close();
      return m_iChannelId > 0;
    }
    else
    {
      database->Persist(*this, true);
      return true;
    }
  }

  return false;
}
开发者ID:rdaoc,项目名称:xbmc,代码行数:21,代码来源:PVRChannel.cpp


注:本文中的CPVRDatabase::Open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。