本文整理汇总了C++中CPVRChannelPtr::ChannelName方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr::ChannelName方法的具体用法?C++ CPVRChannelPtr::ChannelName怎么用?C++ CPVRChannelPtr::ChannelName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelPtr
的用法示例。
在下文中一共展示了CPVRChannelPtr::ChannelName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SwitchChannel
bool CPVRClients::SwitchChannel(const CPVRChannelPtr &channel)
{
assert(channel.get());
{
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;
}
bool bSwitchSuccessful(false);
CPVRChannelPtr currentChannel(GetPlayingChannel());
if (// no channel is currently playing
!currentChannel ||
// different backend
currentChannel->ClientID() != channel->ClientID() ||
// stream URL should always be opened as a new file
!channel->StreamURL().empty() || !currentChannel->StreamURL().empty())
{
if (channel->StreamURL().empty())
{
CloseStream();
bSwitchSuccessful = OpenStream(channel, true);
}
else
{
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(channel)));
bSwitchSuccessful = true;
}
}
// same channel
else if (currentChannel && currentChannel == channel)
{
bSwitchSuccessful = true;
}
else
{
PVR_CLIENT client;
if (GetConnectedClient(channel->ClientID(), client))
bSwitchSuccessful = client->SwitchChannel(channel);
}
{
CSingleLock lock(m_critSection);
m_bIsSwitchingChannels = false;
}
if (!bSwitchSuccessful)
CLog::Log(LOGERROR, "PVR - %s - cannot switch to channel '%s' on client '%d'",__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
return bSwitchSuccessful;
}
示例2: GetEPGForChannel
PVR_ERROR CPVRClients::GetEPGForChannel(const CPVRChannelPtr &channel, CEpg *epg, time_t start, time_t end)
{
assert(channel.get());
PVR_ERROR error(PVR_ERROR_UNKNOWN);
PVR_CLIENT client;
if (GetConnectedClient(channel->ClientID(), client))
error = client->GetEPGForChannel(channel, epg, start, end);
if (error != PVR_ERROR_NO_ERROR)
CLog::Log(LOGERROR, "PVR - %s - cannot get EPG for channel '%s' from client '%d': %s",__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID(), CPVRClient::ToString(error));
return error;
}
示例3: UpdateFromScraper
bool CEpg::UpdateFromScraper(time_t start, time_t end)
{
bool bGrabSuccess = false;
if (ScraperName() == "client")
{
CPVRChannelPtr channel = Channel();
if (!channel)
{
CLog::Log(LOGWARNING, "EPG - %s - channel not found, can't update", __FUNCTION__);
}
else if (!channel->EPGEnabled())
{
#if EPG_DEBUGGING
CLog::Log(LOGDEBUG, "EPG - %s - EPG updating disabled in the channel configuration", __FUNCTION__);
#endif
bGrabSuccess = true;
}
else if (channel->IsHidden())
{
#if EPG_DEBUGGING
CLog::Log(LOGDEBUG, "EPG - %s - channel '%s' on client '%i' is hidden", __FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
#endif
bGrabSuccess = true;
}
else if (!g_PVRClients->SupportsEPG(channel->ClientID()))
{
CLog::Log(LOGDEBUG, "EPG - %s - the backend for channel '%s' on client '%i' does not support EPGs", __FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
}
else
{
CLog::Log(LOGDEBUG, "EPG - %s - updating EPG for channel '%s' from client '%i'", __FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
bGrabSuccess = (g_PVRClients->GetEPGForChannel(channel, this, start, end) == PVR_ERROR_NO_ERROR);
}
}
else if (m_strScraperName.empty()) /* no grabber defined */
CLog::Log(LOGWARNING, "EPG - %s - no EPG scraper defined for table '%s'", __FUNCTION__, m_strName.c_str());
else
{
CLog::Log(LOGINFO, "EPG - %s - updating EPG table '%s' with scraper '%s'", __FUNCTION__, m_strName.c_str(), m_strScraperName.c_str());
CLog::Log(LOGWARNING, "loading the EPG via scraper has not been implemented yet");
//! @todo Add Support for Web EPG Scrapers here
}
return bGrabSuccess;
}
示例4: Update
void CGUIDialogPVRChannelManager::Update()
{
// lock our display, as this window is rendered from the player thread
g_graphicsContext.Lock();
m_viewControl.SetCurrentView(CONTROL_LIST_CHANNELS);
// empty the lists ready for population
Clear();
CPVRChannelGroupPtr channels = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);
// No channels available, nothing to do.
if(!channels)
return;
std::vector<PVRChannelGroupMember> groupMembers(channels->GetMembers());
CFileItemPtr channelFile;
for (std::vector<PVRChannelGroupMember>::const_iterator it = groupMembers.begin(); it != groupMembers.end(); ++it)
{
channelFile = CFileItemPtr(new CFileItem((*it).channel));
if (!channelFile || !channelFile->HasPVRChannelInfoTag())
continue;
const CPVRChannelPtr channel(channelFile->GetPVRChannelInfoTag());
channelFile->SetProperty("ActiveChannel", !channel->IsHidden());
channelFile->SetProperty("Name", channel->ChannelName());
channelFile->SetProperty("UseEPG", channel->EPGEnabled());
channelFile->SetProperty("Icon", channel->IconPath());
channelFile->SetProperty("EPGSource", (int)0);
channelFile->SetProperty("ParentalLocked", channel->IsLocked());
channelFile->SetProperty("Number", StringUtils::Format("%i", channel->ChannelNumber()));
std::string clientName;
g_PVRClients->GetClientName(channel->ClientID(), clientName);
channelFile->SetProperty("ClientName", clientName);
channelFile->SetProperty("SupportsSettings", g_PVRClients->SupportsChannelSettings(channel->ClientID()));
m_channelItems->Add(channelFile);
}
{
std::vector< std::pair<std::string, int> > labels;
labels.push_back(std::make_pair(g_localizeStrings.Get(19210), 0));
/// TODO: Add Labels for EPG scrapers here
SET_CONTROL_LABELS(SPIN_EPGSOURCE_SELECTION, 0, &labels);
}
m_clientsWithSettingsList = g_PVRClients->GetClientsSupportingChannelSettings(m_bIsRadio);
if (!m_clientsWithSettingsList.empty())
m_bAllowNewChannel = true;
if (m_bAllowNewChannel)
SET_CONTROL_VISIBLE(BUTTON_NEW_CHANNEL);
else
SET_CONTROL_HIDDEN(BUTTON_NEW_CHANNEL);
Renumber();
m_viewControl.SetItems(*m_channelItems);
m_viewControl.SetSelectedItem(m_iSelected);
g_graphicsContext.Unlock();
}
示例5: SwitchToChannel
bool CPVRGUIActions::SwitchToChannel(const CFileItemPtr &item, bool bPlayMinimized, bool bCheckResume) const
{
if (item->m_bIsFolder)
return false;
const CPVRChannelPtr channel(CPVRItem(item).GetChannel());
if ((channel && g_PVRManager.IsPlayingChannel(channel)) ||
(channel && channel->HasRecording() && g_PVRManager.IsPlayingRecording(channel->GetRecording())))
{
CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, g_windowManager.GetActiveWindow());
g_windowManager.SendMessage(msg);
return true;
}
CMediaSettings::GetInstance().SetVideoStartWindowed(bPlayMinimized);
// switch to channel or if recording present, ask whether to switch or play recording...
bool bSwitchSuccessful(false);
if (channel && g_PVRManager.CheckParentalLock(channel))
{
const CPVRRecordingPtr recording(channel->GetRecording());
if (recording)
{
bool bCancel(false);
bool bPlayRecording = CGUIDialogYesNo::ShowAndGetInput(CVariant{19687}, // "Play recording"
CVariant{""},
CVariant{12021}, // "Play from beginning"
CVariant{recording->m_strTitle},
bCancel,
CVariant{19000}, // "Switch to channel"
CVariant{19687}, // "Play recording"
0); // no autoclose
if (bCancel)
return false;
if (bPlayRecording)
{
const CFileItemPtr recordingItem(new CFileItem(recording));
return PlayRecording(recordingItem, CSettings::GetInstance().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED), bCheckResume);
}
}
/* try a fast switch */
if ((g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) &&
(channel->IsRadio() == g_PVRManager.IsPlayingRadio()))
{
if (channel->StreamURL().empty())
bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(channel);
}
if (!bSwitchSuccessful)
{
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(channel)));
return true;
}
}
if (!bSwitchSuccessful)
{
std::string channelName = g_localizeStrings.Get(19029); // Channel
if (channel)
channelName = channel->ChannelName();
std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(19166), msg); // PVR information
return false;
}
return true;
}
示例6: OnMessage
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.m_pPlayer->IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
m_bGroupSelectShow = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SUBTITLES);
if (pDialog) pDialog->Close(true);
CGUIWindow::OnMessage(message);
CSettings::Get().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
return true;
}
case GUI_MSG_CLICKED:
{
unsigned int iControl = message.GetSenderId();
if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted())
{
// Get the currently selected label of the Select button
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
OnMessage(msg);
CStdString strLabel = msg.GetLabel();
CPVRChannelPtr playingChannel;
if (g_PVRManager.GetCurrentChannel(playingChannel))
{
CPVRChannelGroupPtr selectedGroup = g_PVRChannelGroups->Get(playingChannel->IsRadio())->GetByName(strLabel);
if (selectedGroup)
{
g_PVRManager.SetPlayingGroup(selectedGroup);
CLog::Log(LOGDEBUG, "%s - switched to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str());
if (!selectedGroup->IsGroupMember(*playingChannel))
{
CLog::Log(LOGDEBUG, "%s - channel '%s' is not a member of '%s', switching to channel 1 of the new group",
__FUNCTION__, playingChannel->ChannelName().c_str(), selectedGroup->GroupName().c_str());
CFileItemPtr switchChannel = selectedGroup->GetByChannelNumber(1);
if (switchChannel && switchChannel->HasPVRChannelInfoTag())
g_application.OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) switchChannel->GetPVRChannelInfoTag()->ChannelNumber()));
else
{
CLog::Log(LOGERROR, "%s - cannot find channel '1' in group %s", __FUNCTION__, selectedGroup->GroupName().c_str());
CApplicationMessenger::Get().MediaStop(false);
}
//.........这里部分代码省略.........
示例7: CheckParentalLock
bool CPVRManager::CheckParentalLock(const CPVRChannelPtr &channel)
{
bool bReturn = !IsParentalLocked(channel) ||
CheckParentalPIN();
if (!bReturn)
CLog::Log(LOGERROR, "PVRManager - %s - parental lock verification failed for channel '%s': wrong PIN entered.", __FUNCTION__, channel->ChannelName().c_str());
return bReturn;
}
示例8: SearchAndSetChannelIcons
void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
std::string iconPath = CSettings::GetInstance().GetString(CSettings::SETTING_PVRMENU_ICONPATH);
if (iconPath.empty())
return;
CPVRDatabase *database = GetPVRDatabase();
if (!database)
return;
/* fetch files in icon path for fast lookup */
CFileItemList fileItemList;
XFILE::CDirectory::GetDirectory(iconPath, fileItemList, ".jpg|.png|.tbn");
if (fileItemList.IsEmpty())
return;
CGUIDialogExtendedProgressBar* dlgProgress = (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
CGUIDialogProgressBarHandle* dlgProgressHandle = dlgProgress ? dlgProgress->GetHandle(g_localizeStrings.Get(19287)) : NULL;
CSingleLock lock(m_critSection);
/* create a map for fast lookup of normalized file base name */
std::map<std::string, std::string> fileItemMap;
const VECFILEITEMS &items = fileItemList.GetList();
for(VECFILEITEMS::const_iterator it = items.begin(); it != items.end(); ++it)
{
std::string baseName = URIUtils::GetFileName((*it)->GetPath());
URIUtils::RemoveExtension(baseName);
StringUtils::ToLower(baseName);
fileItemMap.insert(std::make_pair(baseName, (*it)->GetPath()));
}
int channelIndex = 0;
CPVRChannelPtr channel;
for(PVR_CHANNEL_GROUP_MEMBERS::const_iterator it = m_members.begin(); it != m_members.end(); ++it)
{
channel = it->second.channel;
/* update progress dialog */
if (dlgProgressHandle)
{
dlgProgressHandle->SetProgress(channelIndex++, m_members.size());
dlgProgressHandle->SetText(channel->ChannelName());
}
/* skip if an icon is already set and exists */
if (channel->IsIconExists())
continue;
/* reset icon before searching for a new one */
channel->SetIconPath("");
std::string strChannelUid = StringUtils::Format("%08d", channel->UniqueID());
std::string strLegalClientChannelName = CUtil::MakeLegalFileName(channel->ClientChannelName());
StringUtils::ToLower(strLegalClientChannelName);
std::string strLegalChannelName = CUtil::MakeLegalFileName(channel->ChannelName());
StringUtils::ToLower(strLegalChannelName);
std::map<std::string, std::string>::iterator itItem;
if ((itItem = fileItemMap.find(strLegalClientChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strLegalChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strChannelUid)) != fileItemMap.end())
{
channel->SetIconPath(itItem->second, g_advancedSettings.m_bPVRAutoScanIconsUserSet);
}
if (bUpdateDb)
channel->Persist();
/* TODO: start channel icon scraper here if nothing was found */
}
if (dlgProgressHandle)
dlgProgressHandle->MarkFinished();
}
示例9: CreateFromEpg
CPVRTimerInfoTagPtr CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTagPtr &tag, bool bRepeating /* = false */)
{
/* create a new timer */
CPVRTimerInfoTagPtr newTag(new CPVRTimerInfoTag());
/* check if a valid channel is set */
CPVRChannelPtr channel = tag->ChannelTag();
if (!channel)
{
CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
return CPVRTimerInfoTagPtr();
}
/* 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 CPVRTimerInfoTagPtr();
}
/* set the timer data */
CDateTime newStart = tag->StartAsUTC();
CDateTime newEnd = tag->EndAsUTC();
newTag->m_iClientIndex = -1;
newTag->m_iParentClientIndex = PVR_TIMER_NO_PARENT;
newTag->m_strTitle = tag->Title().empty() ? 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->m_channel = channel;
newTag->SetStartFromUTC(newStart);
newTag->SetEndFromUTC(newEnd);
CPVRTimerTypePtr timerType;
if (bRepeating)
{
// create repeating epg-based timer
timerType = CPVRTimerType::CreateFromAttributes(
PVR_TIMER_TYPE_IS_REPEATING,
PVR_TIMER_TYPE_IS_MANUAL | PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES, channel->ClientID());
}
if (!timerType)
{
// create one-shot epg-based timer
timerType = CPVRTimerType::CreateFromAttributes(
PVR_TIMER_TYPE_ATTRIBUTE_NONE,
PVR_TIMER_TYPE_IS_REPEATING | PVR_TIMER_TYPE_IS_MANUAL | PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES, channel->ClientID());
}
if (!timerType)
{
CLog::Log(LOGERROR, "%s - unable to create any epg-based timer type", __FUNCTION__);
return CPVRTimerInfoTagPtr();
}
newTag->SetTimerType(timerType);
newTag->UpdateSummary();
newTag->m_epgTag = g_EpgContainer.GetById(tag->EpgID())->GetTag(tag->StartAsUTC());
/* unused only for reference */
newTag->m_strFileNameAndPath = CPVRTimersPath::PATH_NEW;
return newTag;
}
示例10: PerformChannelSwitch
bool CPVRManager::PerformChannelSwitch(const CPVRChannelPtr &channel, bool bPreview)
{
assert(channel.get());
// 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);
// 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;
}
示例11: SearchAndSetChannelIcons
void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
std::string iconPath = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_PVRMENU_ICONPATH);
if (iconPath.empty())
return;
/* fetch files in icon path for fast lookup */
CFileItemList fileItemList;
XFILE::CDirectory::GetDirectory(iconPath, fileItemList, ".jpg|.png|.tbn", XFILE::DIR_FLAG_DEFAULTS);
if (fileItemList.IsEmpty())
return;
CSingleLock lock(m_critSection);
/* create a map for fast lookup of normalized file base name */
std::map<std::string, std::string> fileItemMap;
for (const auto& item : fileItemList)
{
std::string baseName = URIUtils::GetFileName(item->GetPath());
URIUtils::RemoveExtension(baseName);
StringUtils::ToLower(baseName);
fileItemMap.insert(std::make_pair(baseName, item->GetPath()));
}
CPVRGUIProgressHandler* progressHandler = new CPVRGUIProgressHandler(g_localizeStrings.Get(19286)); // Searching for channel icons
int channelIndex = 0;
CPVRChannelPtr channel;
for(PVR_CHANNEL_GROUP_MEMBERS::const_iterator it = m_members.begin(); it != m_members.end(); ++it)
{
channel = it->second.channel;
/* update progress dialog */
progressHandler->UpdateProgress(channel->ChannelName(), channelIndex++, m_members.size());
/* skip if an icon is already set and exists */
if (channel->IsIconExists())
continue;
/* reset icon before searching for a new one */
channel->SetIconPath("");
std::string strChannelUid = StringUtils::Format("%08d", channel->UniqueID());
std::string strLegalClientChannelName = CUtil::MakeLegalFileName(channel->ClientChannelName());
StringUtils::ToLower(strLegalClientChannelName);
std::string strLegalChannelName = CUtil::MakeLegalFileName(channel->ChannelName());
StringUtils::ToLower(strLegalChannelName);
std::map<std::string, std::string>::iterator itItem;
if ((itItem = fileItemMap.find(strLegalClientChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strLegalChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strChannelUid)) != fileItemMap.end())
{
channel->SetIconPath(itItem->second, CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bPVRAutoScanIconsUserSet);
}
if (bUpdateDb)
channel->Persist();
//! @todo start channel icon scraper here if nothing was found
}
progressHandler->DestroyProgress();
}
示例12: InitializeChannelsList
void CGUIDialogPVRTimerSettings::InitializeChannelsList()
{
m_channelEntries.clear();
CFileItemList channelsList;
CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAll(m_bIsRadio)->GetMembers(channelsList);
for (int i = 0; i < channelsList.Size(); ++i)
{
const CPVRChannelPtr channel(channelsList[i]->GetPVRChannelInfoTag());
std::string channelDescription(
StringUtils::Format("%s %s", channel->ChannelNumber().FormattedChannelNumber().c_str(), channel->ChannelName().c_str()));
m_channelEntries.insert(
std::make_pair(i, ChannelDescriptor(channel->UniqueID(), channel->ClientID(), channelDescription)));
}
// Add special "any channel" entry (used for epg-based timer rules).
m_channelEntries.insert(
std::make_pair(
ENTRY_ANY_CHANNEL, ChannelDescriptor(PVR_CHANNEL_INVALID_UID, 0, g_localizeStrings.Get(809))));
}
示例13: GetListItemAndPlayerLabel
bool CPVRGUIInfo::GetListItemAndPlayerLabel(const CFileItem *item, const CGUIInfo &info, std::string &strValue) const
{
const CPVRTimerInfoTagPtr timer = item->GetPVRTimerInfoTag();
if (timer)
{
switch (info.m_info)
{
case LISTITEM_DATE:
strValue = timer->Summary();
return true;
case LISTITEM_STARTDATE:
strValue = timer->StartAsLocalTime().GetAsLocalizedDate(true);
return true;
case LISTITEM_STARTTIME:
strValue = timer->StartAsLocalTime().GetAsLocalizedTime("", false);
return true;
case LISTITEM_ENDDATE:
strValue = timer->EndAsLocalTime().GetAsLocalizedDate(true);
return true;
case LISTITEM_ENDTIME:
strValue = timer->EndAsLocalTime().GetAsLocalizedTime("", false);
return true;
case LISTITEM_TITLE:
strValue = timer->Title();
return true;
case LISTITEM_COMMENT:
strValue = timer->GetStatus();
return true;
case LISTITEM_TIMERTYPE:
strValue = timer->GetTypeAsString();
return true;
case LISTITEM_CHANNEL_NAME:
strValue = timer->ChannelName();
return true;
case LISTITEM_EPG_EVENT_TITLE:
case LISTITEM_EPG_EVENT_ICON:
case LISTITEM_GENRE:
case LISTITEM_PLOT:
case LISTITEM_PLOT_OUTLINE:
case LISTITEM_DURATION:
case LISTITEM_ORIGINALTITLE:
case LISTITEM_YEAR:
case LISTITEM_SEASON:
case LISTITEM_EPISODE:
case LISTITEM_EPISODENAME:
case LISTITEM_DIRECTOR:
case LISTITEM_CHANNEL_NUMBER:
case LISTITEM_PREMIERED:
break; // obtain value from channel/epg
default:
return false;
}
}
const CPVRRecordingPtr recording(item->GetPVRRecordingInfoTag());
if (recording)
{
// Note: CPVRRecoding is derived from CVideoInfoTag. All base class properties will be handled
// by CVideoGUIInfoProvider. Only properties introduced by CPVRRecording need to be handled here.
switch (info.m_info)
{
case LISTITEM_DATE:
strValue = recording->RecordingTimeAsLocalTime().GetAsLocalizedDateTime(false, false);
return true;
case LISTITEM_STARTDATE:
strValue = recording->RecordingTimeAsLocalTime().GetAsLocalizedDate(true);
return true;
case VIDEOPLAYER_STARTTIME:
case LISTITEM_STARTTIME:
strValue = recording->RecordingTimeAsLocalTime().GetAsLocalizedTime("", false);
return true;
case LISTITEM_ENDDATE:
strValue = recording->EndTimeAsLocalTime().GetAsLocalizedDate(true);
return true;
case VIDEOPLAYER_ENDTIME:
case LISTITEM_ENDTIME:
strValue = recording->EndTimeAsLocalTime().GetAsLocalizedTime("", false);
return true;
case LISTITEM_EXPIRATION_DATE:
if (recording->HasExpirationTime())
{
strValue = recording->ExpirationTimeAsLocalTime().GetAsLocalizedDate(false);
return true;
}
break;
case LISTITEM_EXPIRATION_TIME:
if (recording->HasExpirationTime())
{
strValue = recording->ExpirationTimeAsLocalTime().GetAsLocalizedTime("", false);;
return true;
}
break;
case VIDEOPLAYER_EPISODENAME:
case LISTITEM_EPISODENAME:
strValue = recording->EpisodeName();
return true;
case VIDEOPLAYER_CHANNEL_NAME:
case LISTITEM_CHANNEL_NAME:
strValue = recording->m_strChannelName;
return true;
//.........这里部分代码省略.........
示例14: 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 */
CPVRChannelPtr channel = tag.ChannelTag();
if (!channel)
{
CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
delete newTag;
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__);
delete newTag;
return NULL;
}
/* set the timer data */
CDateTime newStart = tag.StartAsUTC();
CDateTime newEnd = tag.EndAsUTC();
newTag->m_iClientIndex = -1;
newTag->m_strTitle = tag.Title().empty() ? 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->m_channel = channel;
newTag->SetStartFromUTC(newStart);
newTag->SetEndFromUTC(newEnd);
if (tag.Plot().empty())
{
newTag->m_strSummary= StringUtils::Format("%s %s %s %s %s",
newTag->StartAsLocalTime().GetAsLocalizedDate().c_str(),
g_localizeStrings.Get(19159).c_str(),
newTag->StartAsLocalTime().GetAsLocalizedTime("", false).c_str(),
g_localizeStrings.Get(19160).c_str(),
newTag->EndAsLocalTime().GetAsLocalizedTime("", false).c_str());
}
else
{
newTag->m_strSummary = tag.Plot();
}
newTag->m_epgTag = g_EpgContainer.GetById(tag.EpgID())->GetTag(tag.StartAsUTC());
/* unused only for reference */
newTag->m_strFileNameAndPath = "pvr://timers/new";
return newTag;
}
示例15: CreateInstantTimerTag
CPVRTimerInfoTagPtr CPVRTimerInfoTag::CreateInstantTimerTag(const CPVRChannelPtr &channel, int iDuration /* = DEFAULT_PVRRECORD_INSTANTRECORDTIME */)
{
if (!channel)
{
CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
return CPVRTimerInfoTagPtr();
}
CEpgInfoTagPtr epgTag(channel->GetEPGNow());
CPVRTimerInfoTagPtr newTimer;
if (epgTag)
newTimer = CreateFromEpg(epgTag);
if (!newTimer)
{
newTimer.reset(new CPVRTimerInfoTag);
newTimer->m_iClientIndex = PVR_TIMER_NO_CLIENT_INDEX;
newTimer->m_iParentClientIndex = PVR_TIMER_NO_PARENT;
newTimer->m_channel = channel;
newTimer->m_strTitle = channel->ChannelName();
newTimer->m_iChannelNumber = channel->ChannelNumber();
newTimer->m_iClientChannelUid = channel->UniqueID();
newTimer->m_iClientId = channel->ClientID();
newTimer->m_bIsRadio = channel->IsRadio();
// timertype: manual one-shot timer for given client
CPVRTimerTypePtr timerType(CPVRTimerType::CreateFromAttributes(
PVR_TIMER_TYPE_IS_MANUAL, PVR_TIMER_TYPE_IS_REPEATING | PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES, channel->ClientID()));
if (!timerType)
{
CLog::Log(LOGERROR, "%s - unable to create one shot manual timer type", __FUNCTION__);
return CPVRTimerInfoTagPtr();
}
newTimer->SetTimerType(timerType);
}
/* no matter the timer was created from an epg tag, overwrite timer start and end times. */
CDateTime now(CDateTime::GetUTCDateTime());
newTimer->SetStartFromUTC(now);
if (iDuration == DEFAULT_PVRRECORD_INSTANTRECORDTIME)
iDuration = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_PVRRECORD_INSTANTRECORDTIME);
CDateTime endTime = now + CDateTimeSpan(0, 0, iDuration ? iDuration : 120, 0);
newTimer->SetEndFromUTC(endTime);
/* update summary string according to instant recording start/end time */
newTimer->UpdateSummary();
newTimer->m_strSummary = StringUtils::Format(g_localizeStrings.Get(19093).c_str(), newTimer->Summary().c_str());
CDateTime startTime(INSTANT_TIMER_START);
newTimer->SetStartFromUTC(startTime);
newTimer->m_iMarginStart = 0;
newTimer->m_iMarginEnd = 0;
/* set epg tag at timer & timer at epg tag */
newTimer->UpdateEpgInfoTag();
/* unused only for reference */
newTimer->m_strFileNameAndPath = CPVRTimersPath::PATH_NEW;
return newTimer;
}