本文整理汇总了C++中CPVRChannel::ClientID方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannel::ClientID方法的具体用法?C++ CPVRChannel::ClientID怎么用?C++ CPVRChannel::ClientID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannel
的用法示例。
在下文中一共展示了CPVRChannel::ClientID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SwitchChannel
bool CPVRClients::SwitchChannel(const CPVRChannel &channel)
{
bool bSwitchSuccessful(false);
bool bNewStreamOpened(false);
{
CSingleLock lock(m_critSection);
if (m_bIsSwitchingChannels)
{
CLog::Log(LOGDEBUG, "PVRClients - %s - can't switch to channel '%s'. waiting for the previous switch to complete", __FUNCTION__, channel.ChannelName().c_str());
return false;
}
m_bIsSwitchingChannels = true;
}
CPVRChannel currentChannel;
bool bGotPlayingChannel = GetPlayingChannel(currentChannel);
if (bGotPlayingChannel)
{
if (currentChannel != channel)
{
/* different client add-on */
if (currentChannel.ClientID() != channel.ClientID() ||
/* switch from radio -> tv or tv -> radio */
currentChannel.IsRadio() != channel.IsRadio())
{
CloseStream();
bSwitchSuccessful = OpenLiveStream(channel);
}
else if (!channel.StreamURL().IsEmpty() || !currentChannel.StreamURL().IsEmpty())
{
// StreamURL should always be opened as a new file
CFileItem m_currentFile(channel);
g_application.getApplicationMessenger().PlayFile(m_currentFile, false);
bSwitchSuccessful = true;
bNewStreamOpened = true;
}
else
{
boost::shared_ptr<CPVRClient> client;
if (GetConnectedClient(channel.ClientID(), client))
bSwitchSuccessful = client->SwitchChannel(channel);
}
}
else
{
bSwitchSuccessful = true;
}
}
{
CSingleLock lock(m_critSection);
m_bIsSwitchingChannels = false;
if (bSwitchSuccessful && !bNewStreamOpened)
{
m_currentChannel = channel;
m_bIsPlayingLiveTV = true;
ResetQualityData(m_qualityInfo);
m_bIsValidChannelSettings = false;
}
}
if (!bSwitchSuccessful)
CLog::Log(LOGERROR, "PVR - %s - cannot switch channel on client %d",__FUNCTION__, channel.ClientID());
return bSwitchSuccessful;
}
示例2: 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;
}
示例3: 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());
CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel.ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
msg);
}
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;
}
示例4: 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;
}
示例5: CPVRTimerInfoTag
CPVRTimerInfoTag *CPVRTimerInfoTag::InstantTimer()
{
/* create a new timer */
CPVRTimerInfoTag *newTag = new CPVRTimerInfoTag();
if (!newTag)
{
CLog::Log(LOGERROR, "%s - couldn't create new timer", __FUNCTION__);
return NULL;
}
CFileItem *curPlayingChannel = g_PVRManager.GetCurrentPlayingItem();
CPVRChannel *channel = (curPlayingChannel) ? curPlayingChannel->GetPVRChannelInfoTag(): NULL;
if (!channel)
{
CLog::Log(LOGDEBUG, "%s - couldn't find current playing channel", __FUNCTION__);
channel = PVRChannelsTV.GetByChannelNumber(1);
if (!channel)
{
CLog::Log(LOGERROR, "%s - cannot find any channels",
__FUNCTION__);
}
}
int iDuration = g_guiSettings.GetInt("pvrrecord.instantrecordtime");
if (!iDuration)
iDuration = 180; /* default to 180 minutes */
int iPriority = g_guiSettings.GetInt("pvrrecord.defaultpriority");
if (!iPriority)
iPriority = 50; /* default to 50 */
int iLifetime = g_guiSettings.GetInt("pvrrecord.defaultlifetime");
if (!iLifetime)
iLifetime = 30; /* default to 30 days */
/* set the timer data */
newTag->m_iClientIndex = -1;
newTag->m_bIsActive = true;
newTag->m_strTitle = g_localizeStrings.Get(19056);
newTag->m_iChannelNumber = channel->ChannelNumber();
newTag->m_iClientNumber = channel->ClientChannelNumber();
newTag->m_iClientID = channel->ClientID();
newTag->m_bIsRadio = channel->IsRadio();
newTag->m_StartTime = CDateTime::GetCurrentDateTime();
newTag->SetDuration(iDuration);
newTag->m_iPriority = iPriority;
newTag->m_iLifetime = iLifetime;
/* generate summary string */
newTag->m_strSummary.Format("%s %s %s %s %s",
newTag->m_StartTime.GetAsLocalizedDate(),
g_localizeStrings.Get(19159),
newTag->m_StartTime.GetAsLocalizedTime("", false),
g_localizeStrings.Get(19160),
newTag->m_StopTime.GetAsLocalizedTime("", false));
/* unused only for reference */
newTag->m_strFileNameAndPath = "pvr://timers/new";
return newTag;
}
示例6: Persist
bool CPVRDatabase::Persist(CPVRChannel &channel, bool bCommit)
{
bool bReturn(false);
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::LogF(LOGERROR, "Invalid channel uid: %d", channel.UniqueID());
return bReturn;
}
CSingleLock lock(m_critSection);
// Note: Do not use channel.ChannelID value to check presence of channel in channels table. It might not yet be set correctly.
std::string strQuery = PrepareSQL("iUniqueId = %u AND iClientId = %u", channel.UniqueID(), channel.ClientID());
const std::string strValue = GetSingleValue("channels", "idChannel", strQuery);
if (strValue.empty())
{
/* 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(), static_cast<unsigned int>(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, %s, %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(), static_cast<unsigned int>(channel.LastWatched()), channel.ClientID(),
strValue.c_str(),
channel.EpgID());
}
if (QueueInsertQuery(strQuery))
{
bReturn = true;
if (bCommit)
bReturn = CommitInsertQueries();
}
return bReturn;
}
示例7: IsRecordingOnChannel
bool CPVRTimers::IsRecordingOnChannel(const CPVRChannel &channel) const
{
bool bReturn(false);
CSingleLock lock(m_critSection);
for (unsigned int ptr = 0; ptr < size(); ptr++)
{
CPVRTimerInfoTag *timer = at(ptr);
if (timer->IsRecording() && timer->m_iClientChannelUid == channel.UniqueID() && timer->m_iClientId == channel.ClientID())
{
bReturn = true;
break;
}
}
return bReturn;
}
示例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->m_iGenreType = tag.GenreType();
newTag->m_iGenreSubType = tag.GenreSubType();
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: AddToGroup
bool CPVRChannelGroup::AddToGroup(CPVRChannel &channel, int iChannelNumber /* = 0 */, bool bSortAndRenumber /* = true */)
{
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;
CPVRChannel *realChannel = (IsInternalGroup()) ?
&channel :
(CPVRChannel *) g_PVRChannelGroups->GetGroupAll(m_bRadio)->GetByClient(channel.UniqueID(), channel.ClientID());
if (realChannel)
{
PVRChannelGroupMember newMember = { realChannel, iChannelNumber };
m_members.push_back(newMember);
m_bChanged = true;
if (bSortAndRenumber)
{
if (m_bUsingBackendChannelOrder)
SortByClientChannelNumber();
else
SortByChannelNumber();
Renumber();
}
// TODO notify observers
bReturn = true;
}
}
return bReturn;
}
示例10: 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);
}
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;
}
示例11: 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);
}
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;
}
示例12: PerformChannelSwitch
bool CPVRManager::PerformChannelSwitch(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());
// 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());
std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel.ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
msg);
}
else
{
// switch successful
bSwitched = true;
// save previous and load new channel's settings (view mode is updated in
// the player)
g_application.SaveFileState();
g_application.LoadVideoSettings(channel.Path());
// set channel as selected item
CGUIWindowPVRBase::SetSelectedItemPath(channel.IsRadio(), channel.Path());
UpdateLastWatched(channel);
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;
}
示例13: CanRecordInstantly
bool CPVRClients::CanRecordInstantly(void)
{
CPVRChannel currentChannel;
return GetPlayingChannel(currentChannel) && HasRecordingsSupport(currentChannel.ClientID());
}
示例14: 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;
}
示例15: IsRecordingOnChannel
bool CPVRTimers::IsRecordingOnChannel(const CPVRChannel &channel) const
{
CSingleLock lock(m_critSection);
for (map<CDateTime, vector<CPVRTimerInfoTag *>* >::const_iterator it = m_tags.begin(); it != m_tags.end(); it++)
{
for (unsigned int iTimerPtr = 0; iTimerPtr < it->second->size(); iTimerPtr++)
{
CPVRTimerInfoTag *timer = it->second->at(iTimerPtr);
if (timer->IsRecording() && timer->m_iClientChannelUid == channel.UniqueID() && timer->m_iClientId == channel.ClientID())
return true;
}
}
return false;
}