本文整理汇总了C++中CPVRChannelPtr::SetLastWatched方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr::SetLastWatched方法的具体用法?C++ CPVRChannelPtr::SetLastWatched怎么用?C++ CPVRChannelPtr::SetLastWatched使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelPtr
的用法示例。
在下文中一共展示了CPVRChannelPtr::SetLastWatched方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CloseStream
void CPVRManager::CloseStream(void)
{
CPVRChannelPtr channel;
bool bPersistChannel(false);
{
CSingleLock lock(m_critSection);
if (m_addons->GetPlayingChannel(channel))
{
/* store current time in iLastWatched */
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
channel->SetLastWatched(tNow);
bPersistChannel = true;
m_channelGroups->SetLastPlayedGroup(GetPlayingGroup(channel->IsRadio()));
}
m_addons->CloseStream();
SAFE_DELETE(m_currentFile);
}
if (bPersistChannel)
channel->Persist();
}
示例2: UpdateLastWatched
void CPVRManager::UpdateLastWatched(const CPVRChannelPtr &channel)
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
channel->SetLastWatched(tNow);
// update last watched timestamp for group
CPVRChannelGroupPtr group(GetPlayingGroup(channel->IsRadio()));
group->SetLastWatched(tNow);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
}
示例3: OpenLiveStream
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;
}
示例4: UpdateLastWatched
void CPVRManager::UpdateLastWatched(const CPVRChannelPtr &channel, const CDateTime& time)
{
time_t iTime;
time.GetAsTime(iTime);
channel->SetLastWatched(iTime);
// update last watched timestamp for group
CPVRChannelGroupPtr group(GetPlayingGroup(channel->IsRadio()));
group->SetLastWatched(iTime);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
}
示例5: UpdateLastWatched
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);
}
示例6: GetLastPlayedChannel
CFileItemPtr CPVRChannelGroup::GetLastPlayedChannel(unsigned int iCurrentChannel /* = -1 */) const
{
CSingleLock lock(m_critSection);
time_t tCurrentLastWatched(0), tMaxLastWatched(0);
if (iCurrentChannel > 0)
{
CPVRChannelPtr channel = GetByChannelID(iCurrentChannel);
if (channel.get())
{
CDateTime::GetCurrentDateTime().GetAsTime(tMaxLastWatched);
channel->SetLastWatched(tMaxLastWatched);
channel->Persist();
}
}
CPVRChannelPtr returnChannel;
for (unsigned int iChannelPtr = 0; iChannelPtr < m_members.size(); iChannelPtr++)
{
PVRChannelGroupMember groupMember = m_members.at(iChannelPtr);
if (g_PVRClients->IsConnectedClient(groupMember.channel->ClientID()) &&
groupMember.channel->LastWatched() > 0 &&
(tMaxLastWatched == 0 || groupMember.channel->LastWatched() < tMaxLastWatched) &&
(tCurrentLastWatched == 0 || groupMember.channel->LastWatched() > tCurrentLastWatched))
{
returnChannel = groupMember.channel;
tCurrentLastWatched = returnChannel->LastWatched();
}
}
if (returnChannel)
{
CFileItemPtr retVal = CFileItemPtr(new CFileItem(*returnChannel));
return retVal;
}
CFileItemPtr retVal = CFileItemPtr(new CFileItem);
return retVal;
}
示例7: CloseStream
void CPVRManager::CloseStream(void)
{
CPVRChannelPtr channel;
CPVRChannelGroupPtr group;
bool bPersistChanges(false);
{
CSingleLock lock(m_critSection);
if (m_addons->GetPlayingChannel(channel))
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
/* update last watched timestamp for channel */
channel->SetLastWatched(tNow);
/* update last watched timestamp for group */
group = g_PVRManager.GetPlayingGroup(channel->IsRadio());
group->SetLastWatched(tNow);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
bPersistChanges = true;
// store channel settings
g_application.SaveFileState();
}
m_addons->CloseStream();
SAFE_DELETE(m_currentFile);
}
if (bPersistChanges)
{
channel->Persist();
group->Persist();
}
}
示例8: OpenLiveStream
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;
bool bPersistChannel(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))
{
/* store current time in iLastWatched */
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
playingChannel->SetLastWatched(tNow);
bPersistChannel = true;
}
}
if (bPersistChannel)
playingChannel->Persist();
return bReturn;
}
示例9: PerformChannelSwitch
bool CPVRManager::PerformChannelSwitch(const CPVRChannel &channel, bool bPreview)
{
// check parental lock state
if (IsParentalLocked(channel))
return false;
// invalid channel
if (channel.ClientID() < 0)
return false;
// check whether we're waiting for a previous switch to complete
{
CSingleLock lock(m_critSection);
if (m_bIsSwitchingChannels)
{
CLog::Log(LOGDEBUG, "PVRManager - %s - can't switch to channel '%s'. waiting for the previous switch to complete",
__FUNCTION__, channel.ChannelName().c_str());
return false;
}
// no need to do anything except switching m_currentFile
if (bPreview)
{
delete m_currentFile;
m_currentFile = new CFileItem(channel);
return true;
}
m_bIsSwitchingChannels = true;
}
CLog::Log(LOGDEBUG, "PVRManager - %s - switching to channel '%s'", __FUNCTION__, channel.ChannelName().c_str());
// store current time in iLastWatched
CPVRChannelPtr currentChannel;
if (m_addons->GetPlayingChannel(currentChannel))
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
currentChannel->SetLastWatched(tNow);
}
// store channel settings
SaveCurrentChannelSettings();
// will be deleted by CPVRChannelSwitchJob::DoWork()
CFileItem* previousFile = m_currentFile;
m_currentFile = NULL;
bool bSwitched(false);
// switch channel
if (!m_addons->SwitchChannel(channel))
{
// switch failed
CSingleLock lock(m_critSection);
m_bIsSwitchingChannels = false;
CLog::Log(LOGERROR, "PVRManager - %s - failed to switch to channel '%s'", __FUNCTION__, channel.ChannelName().c_str());
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
g_localizeStrings.Get(19035)); // This channel cannot be played. Check the log for details.
}
else
{
// switch successful
bSwitched = true;
CSingleLock lock(m_critSection);
m_currentFile = new CFileItem(channel);
m_bIsSwitchingChannels = false;
CLog::Log(LOGNOTICE, "PVRManager - %s - switched to channel '%s'", __FUNCTION__, channel.ChannelName().c_str());
}
// announce OnStop and OnPlay. yes, this ain't pretty
{
CSingleLock lock(m_critSectionTriggers);
m_pendingUpdates.push_back(new CPVRChannelSwitchJob(previousFile, m_currentFile));
}
m_triggerEvent.Set();
return bSwitched;
}
示例10: PerformChannelSwitch
bool CPVRManager::PerformChannelSwitch(const CPVRChannel &channel, bool bPreview)
{
bool bSwitched(false);
if (IsParentalLocked(channel))
return false;
CSingleLock lock(m_critSection);
if (m_bIsSwitchingChannels)
{
CLog::Log(LOGDEBUG, "PVRManager - %s - can't switch to channel '%s'. waiting for the previous switch to complete",
__FUNCTION__, channel.ChannelName().c_str());
return bSwitched;
}
m_bIsSwitchingChannels = true;
CLog::Log(LOGDEBUG, "PVRManager - %s - switching to channel '%s'",
__FUNCTION__, channel.ChannelName().c_str());
/* make sure that channel settings are persisted */
if (!bPreview)
{
CPVRChannelPtr currentChannel;
if (m_addons->GetPlayingChannel(currentChannel))
{
/* store current time in iLastWatched */
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
currentChannel->SetLastWatched(tNow);
}
SaveCurrentChannelSettings();
}
SAFE_DELETE(m_currentFile);
lock.Leave();
if (!bPreview && (channel.ClientID() < 0 || !m_addons->SwitchChannel(channel)))
{
lock.Enter();
m_bIsSwitchingChannels = false;
lock.Leave();
CLog::Log(LOGERROR, "PVRManager - %s - failed to switch to channel '%s'",
__FUNCTION__, channel.ChannelName().c_str());
}
else
{
bSwitched = true;
lock.Enter();
m_currentFile = new CFileItem(channel);
if (!bPreview)
CLog::Log(LOGNOTICE, "PVRManager - %s - switched to channel '%s'",
__FUNCTION__, channel.ChannelName().c_str());
m_bIsSwitchingChannels = false;
}
if (!bSwitched)
{
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
g_localizeStrings.Get(19035)); // This channel cannot be played. Check the log for details.
}
return bSwitched;
}