本文整理汇总了C++中CEpgInfoTagPtr::StartAsUTC方法的典型用法代码示例。如果您正苦于以下问题:C++ CEpgInfoTagPtr::StartAsUTC方法的具体用法?C++ CEpgInfoTagPtr::StartAsUTC怎么用?C++ CEpgInfoTagPtr::StartAsUTC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEpgInfoTagPtr
的用法示例。
在下文中一共展示了CEpgInfoTagPtr::StartAsUTC方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateEntry
bool CEpg::UpdateEntry(const CEpgInfoTagPtr &tag, bool bUpdateDatabase /* = false */)
{
CEpgInfoTagPtr infoTag;
{
CSingleLock lock(m_critSection);
std::map<CDateTime, CEpgInfoTagPtr>::iterator it = m_tags.find(tag->StartAsUTC());
bool bNewTag(false);
if (it != m_tags.end())
{
infoTag = it->second;
}
else
{
infoTag.reset(new CEpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : ""));
infoTag->SetUniqueBroadcastID(tag->UniqueBroadcastID());
m_tags.insert(std::make_pair(tag->StartAsUTC(), infoTag));
bNewTag = true;
}
infoTag->Update(*tag, bNewTag);
infoTag->SetEpg(this);
infoTag->SetPVRChannel(m_pvrChannel);
if (bUpdateDatabase)
m_changedTags.insert(std::make_pair(infoTag->UniqueBroadcastID(), infoTag));
}
infoTag->SetTimer(g_PVRTimers->GetTimerForEpgTag(infoTag));
infoTag->SetRecording(g_PVRRecordings->GetRecordingForEpgTag(infoTag));
return true;
}
示例2: FindChannelAndBlockIndex
void CGUIEPGGridContainerModel::FindChannelAndBlockIndex(int channelUid, unsigned int broadcastUid, int eventOffset, int &newChannelIndex, int &newBlockIndex) const
{
const CDateTimeSpan blockDuration(0, 0, MINSPERBLOCK, 0);
bool bFoundPrevChannel = false;
for (size_t channel = 0; channel < m_channelItems.size(); ++channel)
{
CDateTime gridCursor(m_gridStart); //reset cursor for new channel
unsigned long progIdx = m_epgItemsPtr[channel].start;
unsigned long lastIdx = m_epgItemsPtr[channel].stop;
int iEpgId = m_programmeItems[progIdx]->GetEPGInfoTag()->EpgID();
CEpgInfoTagPtr tag;
CPVRChannelPtr chan;
for (int block = 0; block < m_blocks; ++block)
{
while (progIdx <= lastIdx)
{
tag = m_programmeItems[progIdx]->GetEPGInfoTag();
if (tag->EpgID() != iEpgId || gridCursor < tag->StartAsUTC() || m_gridEnd <= tag->StartAsUTC())
break; // next block
if (gridCursor < tag->EndAsUTC())
{
if (broadcastUid > 0 && tag->UniqueBroadcastID() == broadcastUid)
{
newChannelIndex = channel;
newBlockIndex = block + eventOffset;
return; // both found. done.
}
if (!bFoundPrevChannel && channelUid > -1)
{
chan = tag->ChannelTag();
if (chan && chan->UniqueID() == channelUid)
{
newChannelIndex = channel;
bFoundPrevChannel = true;
}
}
break; // next block
}
progIdx++;
}
gridCursor += blockDuration;
}
}
}
示例3: GetTimerForEpgTag
CFileItemPtr CPVRTimers::GetTimerForEpgTag(const CFileItem *item) const
{
if (item && item->HasEPGInfoTag() && item->GetEPGInfoTag()->ChannelTag())
{
const CEpgInfoTagPtr epgTag(item->GetEPGInfoTag());
const CPVRChannelPtr channel(epgTag->ChannelTag());
CSingleLock lock(m_critSection);
for (MapTags::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it)
{
for (VecTimerInfoTag::const_iterator timerIt = it->second->begin(); timerIt != it->second->end(); ++timerIt)
{
CPVRTimerInfoTagPtr timer = *timerIt;
if (timer->GetEpgInfoTag() == epgTag ||
(timer->m_iClientChannelUid == channel->UniqueID() &&
timer->m_bIsRadio == channel->IsRadio() &&
timer->StartAsUTC() <= epgTag->StartAsUTC() &&
timer->EndAsUTC() >= epgTag->EndAsUTC()))
{
CFileItemPtr fileItem(new CFileItem(timer));
return fileItem;
}
}
}
}
CFileItemPtr fileItem;
return fileItem;
}
示例4: FilterTimers
int EpgSearchFilter::FilterTimers(CFileItemList &results)
{
int iRemoved(0);
if (!g_PVRManager.IsStarted())
return iRemoved;
vector<CFileItemPtr> timers = g_PVRTimers->GetActiveTimers();
// TODO inefficient!
for (unsigned int iTimerPtr = 0; iTimerPtr < timers.size(); iTimerPtr++)
{
CFileItemPtr fileItem = timers.at(iTimerPtr);
if (!fileItem || !fileItem->HasPVRTimerInfoTag())
continue;
CPVRTimerInfoTag *timer = fileItem->GetPVRTimerInfoTag();
if (!timer)
continue;
for (int iResultPtr = 0; iResultPtr < results.Size(); iResultPtr++)
{
const CEpgInfoTagPtr epgentry(results.Get(iResultPtr)->GetEPGInfoTag());
if (!epgentry ||
*epgentry->ChannelTag() != *timer->ChannelTag() ||
epgentry->StartAsUTC() < timer->StartAsUTC() ||
epgentry->EndAsUTC() > timer->EndAsUTC())
continue;
results.Remove(iResultPtr);
iResultPtr--;
++iRemoved;
}
}
return iRemoved;
}
示例5: UpdateEntry
bool CEpg::UpdateEntry(const CEpgInfoTagPtr &tag, bool bNotifyObeservers, bool bUpdateDatabase /* = false */)
{
CSingleLock lock(m_critSection);
auto it = m_tags.find(tag->StartAsUTC());
EPG_EVENT_STATE state = (it == m_tags.end()) ? EPG_EVENT_CREATED : EPG_EVENT_UPDATED;
if (UpdateEntry(tag, state, it, bUpdateDatabase) && bNotifyObeservers)
{
SetChanged();
lock.Leave();
NotifyObservers(ObservableMessageEpg);
return true;
}
return false;
}
示例6: GetTimerForEpgTag
CPVRTimerInfoTagPtr CPVRTimers::GetTimerForEpgTag(const CEpgInfoTagPtr &epgTag) const
{
if (epgTag)
{
// already a timer assigned to tag?
CPVRTimerInfoTagPtr timer(epgTag->Timer());
if (timer)
return timer;
// try to find a matching timer for the tag.
if (epgTag->ChannelTag())
{
const CPVRChannelPtr channel(epgTag->ChannelTag());
CSingleLock lock(m_critSection);
for (MapTags::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it)
{
for (VecTimerInfoTag::const_iterator timerIt = it->second->begin(); timerIt != it->second->end(); ++timerIt)
{
timer = *timerIt;
if (!timer->IsRepeating() &&
(timer->GetEpgInfoTag(false) == epgTag ||
(timer->m_iEpgUid != EPG_TAG_INVALID_UID && timer->m_iEpgUid == epgTag->UniqueBroadcastID()) ||
(timer->m_iClientChannelUid == channel->UniqueID() &&
timer->m_bIsRadio == channel->IsRadio() &&
timer->StartAsUTC() <= epgTag->StartAsUTC() &&
timer->EndAsUTC() >= epgTag->EndAsUTC())))
{
return timer;
}
}
}
}
}
return CPVRTimerInfoTagPtr();
}
示例7: CreateFromEpg
CPVRTimerInfoTagPtr CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTagPtr &tag)
{
/* create a new timer */
CPVRTimerInfoTagPtr newTag(new CPVRTimerInfoTag());
if (!newTag)
{
CLog::Log(LOGERROR, "%s - couldn't create new timer", __FUNCTION__);
return CPVRTimerInfoTagPtr();
}
/* 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_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;
}
示例8: Refresh
//.........这里部分代码省略.........
FreeItemsMemory();
////////////////////////////////////////////////////////////////////////
// Create epg grid
const CDateTimeSpan blockDuration(0, 0, MINSPERBLOCK, 0);
const CDateTimeSpan gridDuration(m_gridEnd - m_gridStart);
m_blocks = (gridDuration.GetDays() * 24 * 60 + gridDuration.GetHours() * 60 + gridDuration.GetMinutes()) / MINSPERBLOCK;
if (m_blocks >= MAXBLOCKS)
m_blocks = MAXBLOCKS;
m_gridIndex.reserve(m_channelItems.size());
const std::vector<GridItem> blocks(m_blocks);
for (size_t channel = 0; channel < m_channelItems.size(); ++channel)
{
m_gridIndex.emplace_back(blocks);
CDateTime gridCursor(m_gridStart); //reset cursor for new channel
unsigned long progIdx = m_epgItemsPtr[channel].start;
unsigned long lastIdx = m_epgItemsPtr[channel].stop;
int iEpgId = m_programmeItems[progIdx]->GetEPGInfoTag()->EpgID();
int itemSize = 1; // size of the programme in blocks
int savedBlock = 0;
CFileItemPtr item;
CEpgInfoTagPtr tag;
for (int block = 0; block < m_blocks; ++block)
{
while (progIdx <= lastIdx)
{
item = m_programmeItems[progIdx];
tag = item->GetEPGInfoTag();
if (tag->EpgID() != iEpgId || gridCursor < tag->StartAsUTC() || m_gridEnd <= tag->StartAsUTC())
break;
if (gridCursor < tag->EndAsUTC())
{
m_gridIndex[channel][block].item = item;
m_gridIndex[channel][block].progIndex = progIdx;
break;
}
progIdx++;
}
gridCursor += blockDuration;
if (block == 0)
continue;
const CFileItemPtr prevItem(m_gridIndex[channel][block - 1].item);
const CFileItemPtr currItem(m_gridIndex[channel][block].item);
if (block == m_blocks - 1 || prevItem != currItem)
{
// special handling for last block.
int blockDelta = -1;
int sizeDelta = 0;
if (block == m_blocks - 1 && prevItem == currItem)
{
itemSize++;
blockDelta = 0;
sizeDelta = 1;
}
示例9: CreateFromEpg
CPVRTimerInfoTagPtr CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTagPtr &tag, bool bCreateRule /* = 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() && !bCreateRule)
{
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 = PVR_TIMER_NO_CLIENT_INDEX;
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_channel = channel;
newTag->m_iEpgUid = tag->UniqueBroadcastID();
newTag->SetStartFromUTC(newStart);
newTag->SetEndFromUTC(newEnd);
CPVRTimerTypePtr timerType;
if (bCreateRule)
{
// create epg-based timer rule
timerType = CPVRTimerType::CreateFromAttributes(
PVR_TIMER_TYPE_IS_REPEATING,
PVR_TIMER_TYPE_IS_MANUAL | PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES, channel->ClientID());
if (timerType)
{
if (timerType->SupportsEpgTitleMatch())
newTag->m_strEpgSearchString = newTag->m_strTitle;
if (timerType->SupportsWeekdays())
newTag->m_iWeekdays = PVR_WEEKDAY_ALLDAYS;
if (timerType->SupportsStartAnyTime())
newTag->m_bStartAnyTime = true;
if (timerType->SupportsEndAnyTime())
newTag->m_bEndAnyTime = true;
}
}
else
{
// 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->UpdateEpgInfoTag();
/* unused only for reference */
newTag->m_strFileNameAndPath = CPVRTimersPath::PATH_NEW;
return newTag;
}
示例10: 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;
}
示例11: OnMessage
bool CGUIWindowPVRGuide::OnMessage(CGUIMessage& message)
{
bool bReturn = false;
switch (message.GetMessage())
{
case GUI_MSG_CLICKED:
{
if (message.GetSenderId() == m_viewControl.GetCurrentControl())
{
int iItem = m_viewControl.GetSelectedItem();
if (iItem >= 0 && iItem < m_vecItems->Size())
{
CFileItemPtr pItem = m_vecItems->Get(iItem);
/* process actions */
switch (message.GetParam1())
{
case ACTION_SELECT_ITEM:
case ACTION_MOUSE_LEFT_CLICK:
switch(CServiceBroker::GetSettings().GetInt(CSettings::SETTING_EPG_SELECTACTION))
{
case EPG_SELECT_ACTION_CONTEXT_MENU:
OnPopupMenu(iItem);
bReturn = true;
break;
case EPG_SELECT_ACTION_SWITCH:
CPVRGUIActions::GetInstance().SwitchToChannel(pItem, true);
bReturn = true;
break;
case EPG_SELECT_ACTION_PLAY_RECORDING:
CPVRGUIActions::GetInstance().PlayRecording(pItem, true);
bReturn = true;
break;
case EPG_SELECT_ACTION_INFO:
CPVRGUIActions::GetInstance().ShowEPGInfo(pItem);
bReturn = true;
break;
case EPG_SELECT_ACTION_RECORD:
CPVRGUIActions::GetInstance().ToggleTimer(pItem);
bReturn = true;
break;
case EPG_SELECT_ACTION_SMART_SELECT:
{
const CEpgInfoTagPtr tag(pItem->GetEPGInfoTag());
if (tag)
{
const CDateTime start(tag->StartAsUTC());
const CDateTime end(tag->EndAsUTC());
const CDateTime now(CDateTime::GetUTCDateTime());
if (start <= now && now <= end)
{
// current event
CPVRGUIActions::GetInstance().SwitchToChannel(pItem, true);
}
else if (now < start)
{
// future event
if (tag->HasTimer())
CPVRGUIActions::GetInstance().EditTimer(pItem);
else
CPVRGUIActions::GetInstance().AddTimer(pItem, false);
}
else
{
// past event
if (tag->HasRecording())
CPVRGUIActions::GetInstance().PlayRecording(pItem, true);
else
CPVRGUIActions::GetInstance().ShowEPGInfo(pItem);
}
bReturn = true;
}
break;
}
}
break;
case ACTION_SHOW_INFO:
CPVRGUIActions::GetInstance().ShowEPGInfo(pItem);
bReturn = true;
break;
case ACTION_PLAY:
CPVRGUIActions::GetInstance().PlayRecording(pItem, true);
bReturn = true;
break;
case ACTION_RECORD:
CPVRGUIActions::GetInstance().ToggleTimer(pItem);
bReturn = true;
break;
case ACTION_PVR_SHOW_TIMER_RULE:
CPVRGUIActions::GetInstance().AddTimerRule(pItem, true);
bReturn = true;
break;
case ACTION_CONTEXT_MENU:
case ACTION_MOUSE_RIGHT_CLICK:
OnPopupMenu(iItem);
bReturn = true;
break;
}
}
else if (iItem == -1)
//.........这里部分代码省略.........