本文整理汇总了C++中CPVRChannel::LastWatched方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannel::LastWatched方法的具体用法?C++ CPVRChannel::LastWatched怎么用?C++ CPVRChannel::LastWatched使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannel
的用法示例。
在下文中一共展示了CPVRChannel::LastWatched方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetGroupAllTV
CPVRChannel *CPVRChannelGroupsContainer::GetLastPlayedChannel(void) const
{
CPVRChannel *lastChannel = GetGroupAllTV()->GetLastPlayedChannel();
CPVRChannel *lastRadioChannel = GetGroupAllRadio()->GetLastPlayedChannel();
if (!lastChannel || (lastRadioChannel && lastChannel->LastWatched() < lastRadioChannel->LastWatched()))
lastChannel = lastRadioChannel;
return lastChannel;
}
示例2: UpdateLastWatched
bool CPVRDatabase::UpdateLastWatched(const CPVRChannel &channel)
{
std::string strQuery = PrepareSQL("UPDATE channels SET iLastWatched = %d WHERE idChannel = %d",
channel.LastWatched(), channel.ChannelID());
return ExecuteQuery(strQuery);
}
示例3: lock
CPVRChannel *CPVRChannelGroup::GetLastPlayedChannel(void) const
{
CPVRChannel *channel = NULL;
CSingleLock lock(m_critSection);
for (unsigned int iChannelPtr = 0; iChannelPtr < size(); iChannelPtr++)
{
PVRChannelGroupMember groupMember = at(iChannelPtr);
/* check whether the client is loaded */
if (!g_PVRClients->IsConnectedClient(groupMember.channel->ClientID()))
continue;
/* always get the first channel */
if (channel == NULL)
{
channel = groupMember.channel;
continue;
}
/* check whether this channel has a later LastWatched time */
if (groupMember.channel->LastWatched() > channel->LastWatched())
channel = groupMember.channel;
}
return channel;
}
示例4: UpdateLastWatched
bool CPVRDatabase::UpdateLastWatched(const CPVRChannel &channel)
{
CSingleLock lock(m_critSection);
const std::string strQuery = PrepareSQL("UPDATE channels SET iLastWatched = %u WHERE idChannel = %d",
static_cast<unsigned int>(channel.LastWatched()), channel.ChannelID());
return ExecuteQuery(strQuery);
}
示例5: Persist
bool CPVRDatabase::Persist(CPVRChannel &channel)
{
bool bReturn(false);
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVR - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID());
return bReturn;
}
std::string strQuery;
if (channel.ChannelID() <= 0)
{
/* new channel */
strQuery = PrepareSQL("INSERT INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"idEpg) "
"VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.EpgID());
}
else
{
/* update channel */
strQuery = PrepareSQL("REPLACE INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"idChannel, idEpg) "
"VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ChannelID(),
channel.EpgID());
}
if (QueueInsertQuery(strQuery))
{
/* update the channel ID for new channels */
if (channel.ChannelID() <= 0)
channel.SetChannelID((int)m_pDS->lastinsertid());
bReturn = true;
}
return bReturn;
}
示例6: Persist
bool CPVRDatabase::Persist(CPVRChannel &channel, bool bQueueWrite /* = false */)
{
bool bReturn(false);
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVR - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID());
return bReturn;
}
CStdString strQuery;
if (channel.ChannelID() <= 0)
{
/* new channel */
strQuery = PrepareSQL("INSERT INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idEpg) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(),
channel.EpgID());
}
else
{
/* update channel */
strQuery = PrepareSQL("REPLACE INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idChannel, idEpg) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID(),
channel.EpgID());
}
if (bQueueWrite)
{
QueueInsertQuery(strQuery);
bReturn = true;
}
else if (ExecuteQuery(strQuery))
{
CSingleLock lock(channel.m_critSection);
if (channel.m_iChannelId <= 0)
channel.m_iChannelId = (int)m_pDS->lastinsertid();
bReturn = true;
}
return bReturn;
}
示例7: Persist
int CPVRDatabase::Persist(const CPVRChannel &channel, bool bQueueWrite /* = false */)
{
int iReturn = -1;
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVRDB - %s - invalid channel uid: %d",
__FUNCTION__, channel.UniqueID());
return iReturn;
}
CStdString strQuery;
if (channel.ChannelID() <= 0)
{
/* new channel */
strQuery = FormatSQL("INSERT INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idEpg) "
"VALUES (%i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i);",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(),
channel.EpgID());
}
else
{
/* update channel */
strQuery = FormatSQL("REPLACE INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idChannel, idEpg) "
"VALUES (%i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i, %i);",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID(),
channel.EpgID());
}
if (bQueueWrite)
{
QueueInsertQuery(strQuery);
iReturn = 0;
}
else if (ExecuteQuery(strQuery))
{
iReturn = (channel.ChannelID() <= 0) ? (int) m_pDS->lastinsertid() : channel.ChannelID();
}
return iReturn;
}