本文整理汇总了C++中CPVRChannelGroupPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelGroupPtr类的具体用法?C++ CPVRChannelGroupPtr怎么用?C++ CPVRChannelGroupPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPVRChannelGroupPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
CPVRChannelGroupPtr CPVRChannelGroups::GetLastPlayedGroup(int iChannelID /* = -1 */) const
{
CPVRChannelGroupPtr group;
CSingleLock lock(m_critSection);
for (std::vector<CPVRChannelGroupPtr>::const_iterator it = m_groups.begin(); it != m_groups.end(); ++it)
{
if ((*it)->LastWatched() > 0 && (!group || (*it)->LastWatched() > group->LastWatched()) &&
(iChannelID == -1 || (iChannelID >= 0 && (*it)->IsGroupMember(iChannelID))) && !(*it)->IsHidden())
group = (*it);
}
return group;
}
示例2: bReturn
bool CPVRManager::OpenLiveStream(const CFileItem &channel)
{
bool bReturn(false);
if (!channel.HasPVRChannelInfoTag())
return bReturn;
CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
__FUNCTION__, channel.GetPVRChannelInfoTag()->ChannelName().c_str());
// check if we're allowed to play this file
if (IsParentalLocked(*channel.GetPVRChannelInfoTag()))
return bReturn;
CPVRChannelPtr playingChannel;
CPVRChannelGroupPtr group;
bool bPersistChanges(false);
if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
{
CSingleLock lock(m_critSection);
if(m_currentFile)
delete m_currentFile;
m_currentFile = new CFileItem(channel);
if (m_addons->GetPlayingChannel(playingChannel))
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
/* update last watched timestamp for channel */
playingChannel->SetLastWatched(tNow);
/* update last watched timestamp for group */
group = g_PVRManager.GetPlayingGroup(playingChannel->IsRadio());
group->SetLastWatched(tNow);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
bPersistChanges = true;
}
}
if (bPersistChanges)
{
playingChannel->Persist();
group->Persist();
}
return bReturn;
}
示例3: SetSelectedGroup
void CPVRChannelGroups::SetSelectedGroup(CPVRChannelGroupPtr group)
{
// update the selected group
{
CSingleLock lock(m_critSection);
if (m_selectedGroup)
m_selectedGroup->SetSelectedGroup(false);
m_selectedGroup = group;
group->SetSelectedGroup(true);
}
// update the channel number cache
group->Renumber();
}
示例4: GetGroupAllTV
CPVRChannelPtr CPVRChannelGroupsContainer::GetByUniqueID(int iUniqueChannelId, int iClientID) const
{
CPVRChannelPtr channel;
CPVRChannelGroupPtr channelgroup = GetGroupAllTV();
if (channelgroup)
channel = channelgroup->GetByClient(iUniqueChannelId, iClientID);
if (!channelgroup || !channel)
channelgroup = GetGroupAllRadio();
if (channelgroup)
channel = channelgroup->GetByClient(iUniqueChannelId, iClientID);
return channel;
}
示例5: GetGroupAllTV
void CPVRChannelGroupsContainer::SearchMissingChannelIcons(void)
{
CLog::Log(LOGINFO, "PVRChannelGroupsContainer - %s - starting channel icon search", __FUNCTION__);
// TODO: Add Process dialog here
CPVRChannelGroupPtr channelgrouptv = GetGroupAllTV();
CPVRChannelGroupPtr channelgroupradio = GetGroupAllRadio();
if (channelgrouptv)
channelgrouptv->SearchAndSetChannelIcons(true);
if (channelgroupradio)
channelgroupradio->SearchAndSetChannelIcons(true);
CGUIDialogOK::ShowAndGetInput(19103,0,20177,0);
}
示例6: bReturn
bool EpgSearchFilter::MatchChannelNumber(const CEpgInfoTag &tag) const
{
bool bReturn(true);
if (m_iChannelNumber != EPG_SEARCH_UNSET && g_PVRManager.IsStarted())
{
CPVRChannelGroupPtr group = (m_iChannelGroup != EPG_SEARCH_UNSET) ? g_PVRChannelGroups->GetByIdFromAll(m_iChannelGroup) : g_PVRChannelGroups->GetGroupAllTV();
if (!group)
group = CPVRManager::Get().ChannelGroups()->GetGroupAllTV();
bReturn = (m_iChannelNumber == (int) group->GetChannelNumber(*tag.ChannelTag()));
}
return bReturn;
}
示例7: bReturn
bool CPVREpgSearchFilter::MatchChannelNumber(const CPVREpgInfoTagPtr &tag) const
{
bool bReturn(true);
if (m_channelNumber.IsValid() && CServiceBroker::GetPVRManager().IsStarted())
{
CPVRChannelGroupPtr group = (m_iChannelGroup != EPG_SEARCH_UNSET) ? CServiceBroker::GetPVRManager().ChannelGroups()->GetByIdFromAll(m_iChannelGroup) : CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAllTV();
if (!group)
group = CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAllTV();
bReturn = (m_channelNumber == group->GetChannelNumber(tag->Channel()));
}
return bReturn;
}
示例8: GetViewTimelineItems
void CGUIWindowPVRGuide::GetViewTimelineItems(CFileItemList &items)
{
CGUIEPGGridContainer* epgGridContainer = dynamic_cast<CGUIEPGGridContainer*>(GetControl(m_viewControl.GetCurrentControl()));
if (!epgGridContainer)
return;
CPVRChannelGroupPtr group;
{
CSingleLock lock(m_critSection);
// group change detected reset grid coordinates and refresh grid items
if (!m_bRefreshTimelineItems && *m_cachedChannelGroup != *GetGroup())
{
epgGridContainer->ResetCoordinates();
m_bRefreshTimelineItems = true;
RefreshTimelineItems();
}
if (m_newTimeline != nullptr)
{
m_cachedTimeline = m_newTimeline;
m_newTimeline.reset();
}
items.Clear();
items.RemoveDiscCache(GetID());
items.Assign(*m_cachedTimeline, false);
group = m_cachedChannelGroup;
}
CDateTime startDate(group->GetFirstEPGDate());
CDateTime endDate(group->GetLastEPGDate());
CDateTime currentDate = CDateTime::GetCurrentDateTime().GetAsUTCDateTime();
if (!startDate.IsValid())
startDate = currentDate;
if (!endDate.IsValid() || endDate < startDate)
endDate = startDate;
// limit start to linger time
CDateTime maxPastDate = currentDate - CDateTimeSpan(0, 0, g_advancedSettings.m_iEpgLingerTime, 0);
if (startDate < maxPastDate)
startDate = maxPastDate;
epgGridContainer->SetStartEnd(startDate, endDate);
}
示例9: SelectedGroup
CPVRChannelGroupPtr CGUIWindowPVRChannels::SelectNextGroup(void)
{
CPVRChannelGroupPtr currentGroup = SelectedGroup();
CPVRChannelGroupPtr nextGroup = currentGroup->GetNextGroup();
while (nextGroup && *nextGroup != *currentGroup && nextGroup->Size() == 0)
nextGroup = nextGroup->GetNextGroup();
/* always update so users can reset the list */
if (nextGroup)
{
SetSelectedGroup(nextGroup);
UpdateData();
}
return m_selectedGroup;
}
示例10: lock
bool CPVRChannelGroups::Update(const CPVRChannelGroup &group, bool bUpdateFromClient /* = false */)
{
if (group.GroupName().empty() && group.GroupID() <= 0)
return true;
CPVRChannelGroupPtr updateGroup;
{
CSingleLock lock(m_critSection);
// There can be only one internal group! Make sure we never push a new one!
if (group.IsInternalGroup())
updateGroup = GetGroupAll();
// try to find the group by id
if (!updateGroup && group.GroupID() > 0)
updateGroup = GetById(group.GroupID());
// try to find the group by name if we didn't find it yet
if (!updateGroup)
updateGroup = GetByName(group.GroupName());
if (!updateGroup)
{
// create a new group if none was found. Copy the properties immediately
// so the group doesn't get flagged as "changed" further down.
updateGroup = CPVRChannelGroupPtr(new CPVRChannelGroup(group.IsRadio(), group.GroupID(), group.GroupName()));
m_groups.push_back(updateGroup);
}
updateGroup->SetRadio(group.IsRadio());
updateGroup->SetGroupID(group.GroupID());
updateGroup->SetGroupName(group.GroupName());
updateGroup->SetGroupType(group.GroupType());
updateGroup->SetPosition(group.GetPosition());
// don't override properties we only store locally in our PVR database
if (!bUpdateFromClient)
{
updateGroup->SetLastWatched(group.LastWatched());
updateGroup->SetHidden(group.IsHidden());
}
}
// sort groups
SortGroups();
// persist changes
if (bUpdateFromClient)
return updateGroup->Persist();
return true;
}
示例11: database
bool CPVRChannelGroups::Load(void)
{
const CPVRDatabasePtr database(CServiceBroker::GetPVRManager().GetTVDatabase());
if (!database)
return false;
CSingleLock lock(m_critSection);
// remove previous contents
Clear();
CLog::LogFC(LOGDEBUG, LOGPVR, "Loading all %s channel groups", 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::LogFC(LOGDEBUG, LOGPVR, "%d %s groups fetched from the database", m_groups.size(), m_bRadio ? "radio" : "TV");
// load channels of internal group
std::vector<std::shared_ptr<CPVRChannel>> channelsToRemove;
if (!internalGroup->Load(channelsToRemove))
{
CLog::LogF(LOGERROR, "Failed to load 'all channels' group");
return false;
}
RemoveFromAllGroups(channelsToRemove);
// load the other groups from the database
if (!LoadUserDefinedChannelGroups())
{
CLog::LogF(LOGERROR, "Failed to load user defined channel groups");
return false;
}
// set the last played group as selected group at startup
CPVRChannelGroupPtr lastPlayedGroup = GetLastPlayedGroup();
SetSelectedGroup(lastPlayedGroup ? lastPlayedGroup : internalGroup);
CLog::LogFC(LOGDEBUG, LOGPVR, "%d %s channel groups loaded", m_groups.size(), m_bRadio ? "radio" : "TV");
// need at least 1 group
return m_groups.size() > 0;
}
示例12: switch
bool CGUIDialogPVRChannelsOSD::OnAction(const CAction &action)
{
switch (action.GetID())
{
case ACTION_PREVIOUS_CHANNELGROUP:
case ACTION_NEXT_CHANNELGROUP:
{
CPVRChannelGroupPtr group = GetPlayingGroup();
CPVRChannelGroupPtr nextGroup = action.GetID() == ACTION_NEXT_CHANNELGROUP ? group->GetNextGroup() : group->GetPreviousGroup();
g_PVRManager.SetPlayingGroup(nextGroup);
SetLastSelectedItem(group->GroupID());
Update();
return true;
}
}
return CGUIDialog::OnAction(action);
}
示例13: GetPVRDatabase
bool CPVRChannelGroups::Load(void)
{
CPVRDatabase *database = GetPVRDatabase();
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;
}
示例14: GetPlayingGroup
void CPVRManager::UpdateLastWatched(CPVRChannel &channel)
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
// update last watched timestamp for channel
// NOTE: method could be called with a fileitem copy as argument so we need to obtain the right channel instance
CPVRChannelPtr channelPtr = m_channelGroups->GetChannelById(channel.ChannelID());
channelPtr->SetLastWatched(tNow);
channelPtr->Persist();
// update last watched timestamp for group
CPVRChannelGroupPtr group = GetPlayingGroup(channel.IsRadio());
group->SetLastWatched(tNow);
group->Persist();
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
}
示例15: iNextChannelNumber
void CGUIDialogPVRChannelManager::SaveList(void)
{
if (!m_bContainsChanges)
return;
/* display the progress dialog */
CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
pDlgProgress->SetHeading(190);
pDlgProgress->SetLine(0, "");
pDlgProgress->SetLine(1, 328);
pDlgProgress->SetLine(2, "");
pDlgProgress->StartModal();
pDlgProgress->Progress();
pDlgProgress->SetPercentage(0);
/* persist all channels */
unsigned int iNextChannelNumber(0);
CPVRChannelGroupPtr group = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);
if (!group)
return;
for (int iListPtr = 0; iListPtr < m_channelItems->Size(); iListPtr++)
{
CFileItemPtr pItem = m_channelItems->Get(iListPtr);
if (!pItem->HasPVRChannelInfoTag())
continue;
if (pItem->GetProperty("SupportsSettings").asBoolean())
RenameChannel(pItem);
PersistChannel(pItem, group, &iNextChannelNumber);
pDlgProgress->SetPercentage(iListPtr * 100 / m_channelItems->Size());
}
group->SortAndRenumber();
group->Persist();
m_bContainsChanges = false;
SetItemsUnchanged();
pDlgProgress->Close();
}