diff options
-rw-r--r-- | xbmc/pvr/PVRContextMenus.cpp | 52 | ||||
-rw-r--r-- | xbmc/pvr/epg/Epg.cpp | 4 |
2 files changed, 20 insertions, 36 deletions
diff --git a/xbmc/pvr/PVRContextMenus.cpp b/xbmc/pvr/PVRContextMenus.cpp index f8a64bcb81..9faa27d1e8 100644 --- a/xbmc/pvr/PVRContextMenus.cpp +++ b/xbmc/pvr/PVRContextMenus.cpp @@ -268,53 +268,37 @@ bool FindSimilar::Execute(const CFileItemPtr& item) const bool StartRecording::IsVisible(const CFileItem& item) const { - const std::shared_ptr<const CPVRClient> client = CServiceBroker::GetPVRManager().GetClient(item); - - std::shared_ptr<CPVRChannel> channel = item.GetPVRChannelInfoTag(); + const std::shared_ptr<CPVRChannel> channel{item.GetPVRChannelInfoTag()}; if (channel) + { + const std::shared_ptr<const CPVRClient> client{CServiceBroker::GetPVRManager().GetClient(item)}; return client && client->GetClientCapabilities().SupportsTimers() && !CServiceBroker::GetPVRManager().Timers()->IsRecordingOnChannel(*channel); + } - const std::shared_ptr<const CPVREpgInfoTag> epg = item.GetEPGInfoTag(); - if (epg && epg->IsRecordable()) + const std::shared_ptr<const CPVREpgInfoTag> epgTag{item.GetEPGInfoTag()}; + if (epgTag && epgTag->IsRecordable()) { - if (epg->IsGapTag()) - { - channel = CServiceBroker::GetPVRManager().ChannelGroups()->GetChannelForEpgTag(epg); - if (channel) - { - return client && client->GetClientCapabilities().SupportsTimers() && - !CServiceBroker::GetPVRManager().Timers()->IsRecordingOnChannel(*channel); - } - } - else - { - return client && client->GetClientCapabilities().SupportsTimers() && - !CServiceBroker::GetPVRManager().Timers()->GetTimerForEpgTag(epg); - } + const std::shared_ptr<const CPVRClient> client{CServiceBroker::GetPVRManager().GetClient(item)}; + return client && client->GetClientCapabilities().SupportsTimers() && + !CServiceBroker::GetPVRManager().Timers()->GetTimerForEpgTag(epgTag); } + return false; } bool StartRecording::Execute(const CFileItemPtr& item) const { - const std::shared_ptr<const CPVREpgInfoTag> epgTag = item->GetEPGInfoTag(); - if (!epgTag || epgTag->IsActive()) - { - // instant recording - std::shared_ptr<CPVRChannel> channel; - if (epgTag) - channel = CServiceBroker::GetPVRManager().ChannelGroups()->GetChannelForEpgTag(epgTag); + const std::shared_ptr<CPVRChannel> channel{item->GetPVRChannelInfoTag()}; + if (channel) + return CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().SetRecordingOnChannel(channel, + true); - if (!channel) - channel = item->GetPVRChannelInfoTag(); + const std::shared_ptr<const CPVREpgInfoTag> epgTag{item->GetEPGInfoTag()}; + if (epgTag) + return CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().AddTimer(*item, false); - if (channel) - return CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().SetRecordingOnChannel(channel, - true); - } - - return CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().AddTimer(*item, false); + return false; } /////////////////////////////////////////////////////////////////////////////// diff --git a/xbmc/pvr/epg/Epg.cpp b/xbmc/pvr/epg/Epg.cpp index bf1fd4a2ad..8bc6045d20 100644 --- a/xbmc/pvr/epg/Epg.cpp +++ b/xbmc/pvr/epg/Epg.cpp @@ -223,8 +223,8 @@ bool CPVREpg::UpdateEntry(const std::shared_ptr<CPVREpgInfoTag>& tag, EPG_EVENT_ } else { - // Delete running/future events and past events if they are older than epg linger time setting - if ((existingTag->EndAsUTC() >= CDateTime::GetUTCDateTime()) || IsTagExpired(existingTag)) + // Delete future events and past events if they are older than epg linger time setting + if ((existingTag->StartAsUTC() > CDateTime::GetUTCDateTime()) || IsTagExpired(existingTag)) { m_tags.DeleteEntry(existingTag); } |