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


C++ CPVRDatabasePtr类代码示例

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


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

示例1: database

int CPVRChannelGroup::LoadFromDb(bool bCompress /* = false */)
{
  const CPVRDatabasePtr database(CServiceBroker::GetPVRManager().GetTVDatabase());
  if (!database)
    return -1;

  int iChannelCount = Size();

  const CPVRChannelGroupPtr allGroup = CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAll(IsRadio());
  if (!allGroup)
    return -1;

  std::map<int, CPVRChannelPtr> allChannels;
  {
    CSingleLock lock(allGroup->m_critSection);
    for (const auto& groupMember : allGroup->m_members)
    {
      allChannels.insert(std::make_pair(groupMember.second.channel->ChannelID(), groupMember.second.channel));
    }
  }

  database->Get(*this, allChannels);

  return Size() - iChannelCount;
}
开发者ID:gdachs,项目名称:xbmc,代码行数:25,代码来源:PVRChannelGroup.cpp

示例2: bReturn

bool CPVRChannelGroup::Persist(void)
{
  bool bReturn(true);
  const CPVRDatabasePtr database(g_PVRManager.GetTVDatabase());

  CSingleLock lock(m_critSection);

  /* only persist if the group has changes and is fully loaded or never has been saved before */
  if (!HasChanges() || (!m_bLoaded && m_iGroupId != -1))
    return bReturn;

  // Mark newly created groups as loaded so future updates will also be persisted...
  if (m_iGroupId == -1)
    m_bLoaded = true;

  if (database)
  {
    CLog::Log(LOGDEBUG, "CPVRChannelGroup - %s - persisting channel group '%s' with %d channels",
        __FUNCTION__, GroupName().c_str(), (int) m_members.size());
    m_bChanged = false;
    lock.Leave();

    bReturn = database->Persist(*this);
  }
  else
  {
    bReturn = false;
  }

  return bReturn;
}
开发者ID:Elzevir,项目名称:xbmc,代码行数:31,代码来源:PVRChannelGroup.cpp

示例3: database

int CPVRChannelGroup::LoadFromDb(bool bCompress /* = false */)
{
  const CPVRDatabasePtr database(g_PVRManager.GetTVDatabase());
  if (!database)
    return -1;

  int iChannelCount = Size();

  database->Get(*this);

  return Size() - iChannelCount;
}
开发者ID:Elzevir,项目名称:xbmc,代码行数:12,代码来源:PVRChannelGroup.cpp

示例4: database

int CPVRChannelGroup::LoadFromDb(bool bCompress /* = false */)
{
  const CPVRDatabasePtr database(CServiceBroker::GetPVRManager().GetTVDatabase());
  if (!database)
    return -1;

  int iChannelCount = Size();

  database->Get(*this, *m_allChannelsGroup);

  return Size() - iChannelCount;
}
开发者ID:68foxboris,项目名称:xbmc,代码行数:12,代码来源:PVRChannelGroup.cpp

示例5: lock

bool CPVRChannel::SetLastWatched(time_t iLastWatched)
{
  {
    CSingleLock lock(m_critSection);

    if (m_iLastWatched != iLastWatched)
      m_iLastWatched = iLastWatched;
  }

  const CPVRDatabasePtr database(g_PVRManager.GetTVDatabase());
  if (database)
    return database->UpdateLastWatched(*this);

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

示例6: database

int CPVRChannelGroupInternal::LoadFromDb(bool bCompress /* = false */)
{
  const CPVRDatabasePtr database(CServiceBroker::GetPVRManager().GetTVDatabase());
  if (!database)
    return -1;

  int iChannelCount = Size();

  if (database->Get(*this, bCompress) == 0)
    CLog::LogFC(LOGDEBUG, LOGPVR, "No channels in the database");

  SortByChannelNumber();

  return Size() - iChannelCount;
}
开发者ID:AlwinEsch,项目名称:kodi,代码行数:15,代码来源:PVRChannelGroupInternal.cpp

示例7: bFound

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

示例8: database

bool CPVRChannelGroups::Load(void)
{
  const CPVRDatabasePtr database(g_PVRManager.GetTVDatabase());
  if (!database)
    return false;

  CSingleLock lock(m_critSection);

  // remove previous contents
  Clear();

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

  // create the internal channel group
  CPVRChannelGroupPtr internalGroup = CPVRChannelGroupPtr(new CPVRChannelGroupInternal(m_bRadio));
  m_groups.push_back(internalGroup);

  // load groups from the database
  database->Get(*this);
  CLog::Log(LOGDEBUG, "CPVRChannelGroups - %s - %" PRIuS" %s groups fetched from the database", __FUNCTION__, m_groups.size(), m_bRadio ? "radio" : "TV");

  // load channels of internal group
  if (!internalGroup->Load())
  {
    CLog::Log(LOGERROR, "CPVRChannelGroups - %s - failed to load channels", __FUNCTION__);
    return false;
  }

  // load the other groups from the database
  if (!LoadUserDefinedChannelGroups())
  {
    CLog::Log(LOGERROR, "CPVRChannelGroups - %s - failed to load channel groups", __FUNCTION__);
    return false;
  }

  // set the last played group as selected group at startup
  CPVRChannelGroupPtr lastPlayedGroup = GetLastPlayedGroup();
  SetSelectedGroup(lastPlayedGroup ? lastPlayedGroup : internalGroup);

  CLog::Log(LOGDEBUG, "CPVRChannelGroups - %s - %" PRIuS" %s channel groups loaded", __FUNCTION__, m_groups.size(), m_bRadio ? "radio" : "TV");

  // need at least 1 group
  return m_groups.size() > 0;
}
开发者ID:Stane1983,项目名称:xbmc,代码行数:44,代码来源:PVRChannelGroups.cpp

示例9: Delete

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;
}
开发者ID:68foxboris,项目名称:xbmc,代码行数:19,代码来源:PVRChannel.cpp

示例10: lock

bool CPVRChannel::SetLastWatched(time_t iLastWatched)
{
  {
    CSingleLock lock(m_critSection);
    if (m_iLastWatched != iLastWatched)
    {
      m_iLastWatched = iLastWatched;

      const std::shared_ptr<CPVREpg> epg = GetEPG();
      if (epg)
        epg->GetChannelData()->SetLastWatched(iLastWatched);
    }
  }

  const CPVRDatabasePtr database = CServiceBroker::GetPVRManager().GetTVDatabase();
  if (database)
    return database->UpdateLastWatched(*this);

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

示例11: database

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


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