本文整理汇总了C++中CPVRChannel::UniqueID方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannel::UniqueID方法的具体用法?C++ CPVRChannel::UniqueID怎么用?C++ CPVRChannel::UniqueID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannel
的用法示例。
在下文中一共展示了CPVRChannel::UniqueID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddToGroup
bool CPVRChannelGroup::AddToGroup(CPVRChannel &channel, int iChannelNumber /* = 0 */)
{
CSingleLock lock(m_critSection);
bool bReturn(false);
if (!CPVRChannelGroup::IsGroupMember(channel))
{
if (iChannelNumber <= 0 || iChannelNumber > (int) m_members.size() + 1)
iChannelNumber = m_members.size() + 1;
CPVRChannelPtr realChannel = (IsInternalGroup()) ?
GetByClient(channel.UniqueID(), channel.ClientID()) :
g_PVRChannelGroups->GetGroupAll(m_bRadio)->GetByClient(channel.UniqueID(), channel.ClientID());
if (realChannel)
{
PVRChannelGroupMember newMember = { realChannel, (unsigned int)iChannelNumber };
m_members.push_back(newMember);
m_bChanged = true;
SortAndRenumber();
// TODO notify observers
bReturn = true;
}
}
return bReturn;
}
示例2: 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;
}
示例3: 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;
}
示例4: UpdateChannel
long CPVRDatabase::UpdateChannel(const CPVRChannel &channel, bool bQueueWrite /* = false */)
{
long 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 ("
"UniqueId, ChannelNumber, GroupId, IsRadio, IsHidden, "
"IconPath, ChannelName, IsVirtual, EPGEnabled, EPGScraper, ClientId, "
"ClientChannelNumber, InputFormat, StreamURL, EncryptionSystem) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %i, %i, '%s', '%s', %i)\n",
channel.UniqueID(), channel.ChannelNumber(), channel.GroupID(), (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.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem());
}
else
{
/* update channel */
strQuery = FormatSQL("REPLACE INTO Channels ("
"UniqueId, ChannelNumber, GroupId, IsRadio, IsHidden, "
"IconPath, ChannelName, IsVirtual, EPGEnabled, EPGScraper, ClientId, "
"ClientChannelNumber, InputFormat, StreamURL, EncryptionSystem, ChannelId) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %i, %i, '%s', '%s', %i, %i)\n",
channel.UniqueID(), channel.ChannelNumber(), channel.GroupID(), (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.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID());
}
if (bQueueWrite)
{
QueueInsertQuery(strQuery);
iReturn = 0;
}
else if (ExecuteQuery(strQuery))
{
iReturn = (channel.ChannelID() <= 0) ? (long) m_pDS->lastinsertid() : channel.ChannelID();
}
return iReturn;
}
示例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: UpdateChannel
bool CPVRChannelGroupInternal::UpdateChannel(const CPVRChannel &channel)
{
CPVRChannel *updateChannel = (CPVRChannel *) GetByUniqueID(channel.UniqueID());
if (!updateChannel)
{
updateChannel = new CPVRChannel(channel.IsRadio());
PVRChannelGroupMember newMember = { updateChannel, 0 };
push_back(newMember);
updateChannel->SetUniqueID(channel.UniqueID());
}
updateChannel->UpdateFromClient(channel);
return updateChannel->Persist(!m_bLoaded);
}
示例7: UpdateChannel
bool CPVRChannelGroupInternal::UpdateChannel(const CPVRChannel &channel)
{
CSingleLock lock(m_critSection);
CPVRChannelPtr updateChannel = GetByUniqueID(channel.UniqueID());
if (!updateChannel)
{
updateChannel = CPVRChannelPtr(new CPVRChannel(channel.IsRadio()));
PVRChannelGroupMember newMember = { updateChannel, 0 };
m_members.push_back(newMember);
updateChannel->SetUniqueID(channel.UniqueID());
}
updateChannel->UpdateFromClient(channel);
return updateChannel->Persist(!m_bLoaded);
}
示例8: CPVRTimerInfoTag
CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTag &tag)
{
/* create a new timer */
CPVRTimerInfoTag *newTag = new CPVRTimerInfoTag();
if (!newTag)
{
CLog::Log(LOGERROR, "%s - couldn't create new timer", __FUNCTION__);
return NULL;
}
/* check if a valid channel is set */
CPVRChannel *channel = (CPVRChannel *) tag.ChannelTag();
if (channel == NULL)
{
CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
return NULL;
}
/* check if the epg end date is in the future */
if (tag.EndAsLocalTime() < CDateTime::GetCurrentDateTime())
{
CLog::Log(LOGERROR, "%s - end time is in the past", __FUNCTION__);
return NULL;
}
/* set the timer data */
CDateTime newStart = tag.StartAsUTC();
CDateTime newEnd = tag.EndAsUTC();
newTag->m_iClientIndex = -1;
newTag->m_strTitle = tag.Title().IsEmpty() ? channel->ChannelName() : tag.Title();
newTag->m_iChannelNumber = channel->ChannelNumber();
newTag->m_iClientChannelUid = channel->UniqueID();
newTag->m_iClientId = channel->ClientID();
newTag->m_bIsRadio = channel->IsRadio();
newTag->SetStartFromUTC(newStart);
newTag->SetEndFromUTC(newEnd);
if (tag.Plot().IsEmpty())
{
newTag->m_strSummary.Format("%s %s %s %s %s",
newTag->StartAsLocalTime().GetAsLocalizedDate(),
g_localizeStrings.Get(19159),
newTag->StartAsLocalTime().GetAsLocalizedTime("", false),
g_localizeStrings.Get(19160),
newTag->EndAsLocalTime().GetAsLocalizedTime("", false));
}
else
{
newTag->m_strSummary = tag.Plot();
}
/* we might have a copy of the tag here, so get the real one from the pvrmanager */
const CEpg *epgTable = channel->GetEPG();
newTag->m_epgInfo = epgTable ? epgTable->GetTag(tag.UniqueBroadcastID(), tag.StartAsUTC()) : NULL;
/* unused only for reference */
newTag->m_strFileNameAndPath = "pvr://timers/new";
return newTag;
}
示例9: RemoveInvalidChannels
void CPVRChannelGroup::RemoveInvalidChannels(void)
{
for (unsigned int ptr = 0; ptr < size(); ptr--)
{
CPVRChannel *channel = at(ptr).channel;
if (channel->IsVirtual())
continue;
if (at(ptr).channel->ClientChannelNumber() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid client channel number",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
erase(begin() + ptr);
ptr--;
m_bChanged = true;
continue;
}
if (channel->UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid unique ID",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
erase(begin() + ptr);
ptr--;
m_bChanged = true;
continue;
}
}
}
示例10: SwitchChannel
bool CPVRClient::SwitchChannel(const CPVRChannel &channel)
{
bool bSwitched(false);
if (IsPlayingLiveStream() && CanPlayChannel(channel))
{
PVR_CHANNEL tag;
WriteClientChannelInfo(channel, tag);
try
{
bSwitched = m_pStruct->SwitchChannel(tag);
if (bSwitched)
{
m_bCanPauseStream = m_pStruct->CanPauseStream();
m_bCanSeekStream = m_pStruct->CanSeekStream();
}
}
catch (exception &e) { LogException(e, __FUNCTION__); }
}
if (bSwitched)
{
CPVRChannelPtr currentChannel = g_PVRChannelGroups->GetByUniqueID(channel.UniqueID(), channel.ClientID());
CSingleLock lock(m_critSection);
ResetQualityData(m_qualityInfo);
m_playingChannel = currentChannel;
}
return bSwitched;
}
示例11: RemoveDeletedChannels
bool CPVRChannelGroup::RemoveDeletedChannels(const CPVRChannelGroup &channels)
{
bool bReturn(false);
CSingleLock lock(m_critSection);
/* check for deleted channels */
for (int iChannelPtr = size() - 1; iChannelPtr >= 0; iChannelPtr--)
{
CPVRChannel *channel = at(iChannelPtr).channel;
if (!channel)
continue;
if (channels.GetByClient(channel->UniqueID(), channel->ClientID()) == NULL)
{
/* channel was not found */
CLog::Log(LOGINFO,"PVRChannelGroup - %s - deleted %s channel '%s' from group '%s'",
__FUNCTION__, m_bRadio ? "radio" : "TV", channel->ChannelName().c_str(), GroupName().c_str());
/* remove this channel from all non-system groups if this is the internal group */
if (IsInternalGroup())
{
g_PVRChannelGroups->Get(m_bRadio)->RemoveFromAllGroups(channel);
/* since it was not found in the internal group, it was deleted from the backend */
channel->Delete();
}
erase(begin() + iChannelPtr);
m_bChanged = true;
bReturn = true;
}
}
return bReturn;
}
示例12: at
CPVRChannel *CPVRChannels::GetByUniqueID(int iUniqueID)
{
for (unsigned int ptr = 0; ptr < size(); ptr++)
{
CPVRChannel *channel = at(ptr);
if (channel->UniqueID() == iUniqueID)
return channel;
}
return NULL;
}
示例13: UpdateFromClient
bool CPVRChannelGroupInternal::UpdateFromClient(const CPVRChannel &channel)
{
CSingleLock lock(m_critSection);
CPVRChannel *realChannel = (CPVRChannel *) GetByClient(channel.UniqueID(), channel.ClientID());
if (realChannel != NULL)
realChannel->UpdateFromClient(channel);
else
realChannel = new CPVRChannel(channel);
return CPVRChannelGroup::AddToGroup(realChannel, 0, false);
}
示例14: OpenStream
bool CPVRClient::OpenStream(const CPVRChannel &channel, bool bIsSwitchingChannel)
{
bool bReturn(false);
CloseStream();
if(!CanPlayChannel(channel))
{
CLog::Log(LOGDEBUG, "add-on '%s' can not play channel '%s'", GetFriendlyName().c_str(), channel.ChannelName().c_str());
}
else if (!channel.StreamURL().IsEmpty())
{
CLog::Log(LOGDEBUG, "opening live stream on url '%s'", channel.StreamURL().c_str());
bReturn = true;
// the Njoy N7 sometimes doesn't switch channels, but opens a stream to the previous channel
// when not waiting for a short period.
// added in 1.1.0
AddonVersion checkVersion("1.1.0");
if (m_apiVersion >= checkVersion)
{
unsigned int iWaitTimeMs = m_pStruct->GetChannelSwitchDelay();
if (iWaitTimeMs > 0)
XbmcThreads::ThreadSleep(iWaitTimeMs);
}
}
else
{
CLog::Log(LOGDEBUG, "opening live stream for channel '%s'", channel.ChannelName().c_str());
PVR_CHANNEL tag;
WriteClientChannelInfo(channel, tag);
try
{
bReturn = m_pStruct->OpenLiveStream(tag);
if (bReturn)
{
m_bCanPauseStream = m_pStruct->CanPauseStream();
m_bCanSeekStream = m_pStruct->CanSeekStream();
}
}
catch (exception &e) { LogException(e, __FUNCTION__); }
}
if (bReturn)
{
CPVRChannelPtr currentChannel = g_PVRChannelGroups->GetByUniqueID(channel.UniqueID(), channel.ClientID());
CSingleLock lock(m_critSection);
m_playingChannel = currentChannel;
m_bIsPlayingTV = true;
m_bIsPlayingRecording = false;
}
return bReturn;
}
示例15: PVRWriteClientChannelInfo
/*!
* @brief Copy over channel info from xbmcChannel to addonClient.
* @param xbmcChannel The channel on XBMC's side.
* @param addonChannel The channel on the addon's side.
*/
inline void PVRWriteClientChannelInfo(const CPVRChannel &xbmcChannel, PVR_CHANNEL &addonChannel)
{
addonChannel.iUniqueId = xbmcChannel.UniqueID();
addonChannel.iChannelNumber = xbmcChannel.ClientChannelNumber();
addonChannel.strChannelName = xbmcChannel.ClientChannelName().c_str();
addonChannel.strIconPath = xbmcChannel.IconPath().c_str();
addonChannel.iEncryptionSystem = xbmcChannel.EncryptionSystem();
addonChannel.bIsRadio = xbmcChannel.IsRadio();
addonChannel.bIsHidden = xbmcChannel.IsHidden();
addonChannel.strInputFormat = xbmcChannel.InputFormat().c_str();
addonChannel.strStreamURL = xbmcChannel.StreamURL().c_str();
}