CDateTime CPVRChannelGroup::GetEPGDate(EpgDateType epgDateType) const { CDateTime date; CPVREpgPtr epg; CPVRChannelPtr channel; CSingleLock lock(m_critSection); for (PVR_CHANNEL_GROUP_MEMBERS::const_iterator it = m_members.begin(); it != m_members.end(); ++it) { channel = it->second.channel; if (!channel->IsHidden() && (epg = channel->GetEPG())) { CDateTime epgDate; switch (epgDateType) { case EPG_FIRST_DATE: epgDate = epg->GetFirstDate(); if (epgDate.IsValid() && (!date.IsValid() || epgDate < date)) date = epgDate; break; case EPG_LAST_DATE: epgDate = epg->GetLastDate(); if (epgDate.IsValid() && (!date.IsValid() || epgDate > date)) date = epgDate; break; } } } return date; }
int CPVRChannelGroup::GetEPGNowOrNext(CFileItemList &results, bool bGetNext) const { int iInitialSize = results.Size(); CPVREpgInfoTagPtr epgNext; CPVRChannelPtr channel; CSingleLock lock(m_critSection); for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::const_iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end(); ++it) { channel = (*it).channel; CPVREpgPtr epg = channel->GetEPG(); if (epg && !channel->IsHidden()) { epgNext = bGetNext ? epg->GetTagNext() : epg->GetTagNow(); if (epgNext) { CFileItemPtr entry(new CFileItem(epgNext)); entry->SetLabel2(epgNext->StartAsLocalTime().GetAsLocalizedTime("", false)); entry->SetPath(channel->Path()); entry->SetArt("thumb", channel->IconPath()); results.Add(entry); } } } return results.Size() - iInitialSize; }
int CPVRChannelGroup::GetEPGAll(CFileItemList &results, bool bIncludeChannelsWithoutEPG /* = false */) const { int iInitialSize = results.Size(); CPVREpgInfoTagPtr epgTag; CPVRChannelPtr channel; CSingleLock lock(m_critSection); for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::const_iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end(); ++it) { channel = (*it).channel; if (!channel->IsHidden()) { int iAdded = 0; CPVREpgPtr epg = channel->GetEPG(); if (epg) { // XXX channel pointers aren't set in some occasions. this works around the issue, but is not very nice epg->SetChannel(channel); iAdded = epg->Get(results); } if (bIncludeChannelsWithoutEPG && iAdded == 0) { // Add dummy EPG tag associated with this channel epgTag = CPVREpgInfoTag::CreateDefaultTag(); epgTag->SetChannel(channel); results.Add(CFileItemPtr(new CFileItem(epgTag))); } } } return results.Size() - iInitialSize; }
void CGUIWindowPVRChannelsBase::UpdateEpg(const CFileItemPtr &item) { const CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); if (!CGUIDialogYesNo::ShowAndGetInput(CVariant{19251}, // "Update guide information" CVariant{19252}, // "Schedule guide update for this channel?" CVariant{""}, CVariant{channel->ChannelName()})) return; const CPVREpgPtr epg = channel->GetEPG(); if (epg) { epg->ForceUpdate(); const std::string strMessage = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19253).c_str(), // "Guide update scheduled for channel" channel->ChannelName().c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(19166), // "PVR information" strMessage); } else { const std::string strMessage = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19254).c_str(), // "Guide update failed for channel" channel->ChannelName().c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(19166), // "PVR information" strMessage); } }
bool CPVRChannel::ClearEPG() const { const CPVREpgPtr epg = GetEPG(); if (epg) epg->Clear(); return true; }
CPVREpgInfoTagPtr CPVRChannel::GetEPGPrevious() const { CPVREpgInfoTagPtr tag; const CPVREpgPtr epg = GetEPG(); if (epg) tag = epg->GetTagPrevious(); return tag; }
std::vector<std::shared_ptr<CPVREpgInfoTag>> CPVRChannel::GetEpgTags() const { const CPVREpgPtr epg = GetEPG(); if (!epg) { CLog::LogFC(LOGDEBUG, LOGPVR, "Cannot get EPG for channel '%s'", m_strChannelName.c_str()); return {}; } return epg->GetTags(); }
std::vector<std::shared_ptr<CPVREpgInfoTag>> CPVRChannelGroup::GetEPGAll(bool bIncludeChannelsWithoutEPG /* = false */) const { std::vector<std::shared_ptr<CPVREpgInfoTag>> tags; CPVREpgInfoTagPtr epgTag; CPVRChannelPtr channel; CSingleLock lock(m_critSection); for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::const_iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end(); ++it) { channel = (*it).channel; if (!channel->IsHidden()) { bool bEmpty = false; CPVREpgPtr epg = channel->GetEPG(); if (epg) { const std::vector<std::shared_ptr<CPVREpgInfoTag>> epgTags = epg->GetTags(); bEmpty = epgTags.empty(); if (!bEmpty) tags.insert(tags.end(), epgTags.begin(), epgTags.end()); } if (bIncludeChannelsWithoutEPG && bEmpty) { // Add dummy EPG tag associated with this channel if (epg) epgTag = std::make_shared<CPVREpgInfoTag>(epg->GetChannelData(), epg->EpgID()); else epgTag = std::make_shared<CPVREpgInfoTag>(std::make_shared<CPVREpgChannelData>(*channel), -1); tags.emplace_back(epgTag); } } } return tags; }