本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}