Skip to content

Commit

Permalink
Merge pull request xbmc#25780 from ksooo/pvr-fix-stop-recording-ctx-menu
Browse files Browse the repository at this point in the history
[PVR] Context menu item 'Stop recording': Fix visibility condition for EPG gap tags.
  • Loading branch information
ksooo authored Oct 3, 2024
2 parents f5b7241 + b57c953 commit eb29391
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions xbmc/pvr/PVRContextMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,13 @@ bool StopRecording::IsVisible(const CFileItem& item) const
const std::shared_ptr<const CPVREpgInfoTag> epg = item.GetEPGInfoTag();
if (epg && epg->IsGapTag())
{
channel = CServiceBroker::GetPVRManager().ChannelGroups()->GetChannelForEpgTag(epg);
if (channel)
return CServiceBroker::GetPVRManager().Timers()->IsRecordingOnChannel(*channel);
const CDateTime now{CDateTime::GetUTCDateTime()};
if (epg->StartAsUTC() <= now && epg->EndAsUTC() >= now)
{
channel = CServiceBroker::GetPVRManager().ChannelGroups()->GetChannelForEpgTag(epg);
if (channel)
return CServiceBroker::GetPVRManager().Timers()->IsRecordingOnChannel(*channel);
}
}

return false;
Expand All @@ -350,12 +354,16 @@ bool StopRecording::Execute(const CFileItemPtr& item) const
const std::shared_ptr<const CPVREpgInfoTag> epgTag = item->GetEPGInfoTag();
if (epgTag && epgTag->IsGapTag())
{
// instance recording
const std::shared_ptr<CPVRChannel> channel =
CServiceBroker::GetPVRManager().ChannelGroups()->GetChannelForEpgTag(epgTag);
if (channel)
return CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().SetRecordingOnChannel(channel,
false);
const CDateTime now{CDateTime::GetUTCDateTime()};
if (epgTag->StartAsUTC() <= now && epgTag->EndAsUTC() >= now)
{
const std::shared_ptr<CPVRChannel> channel{
CServiceBroker::GetPVRManager().ChannelGroups()->GetChannelForEpgTag(epgTag)};
if (channel)
return CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().SetRecordingOnChannel(
channel, false);
}
return false;
}

return CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().StopRecording(*item);
Expand Down

0 comments on commit eb29391

Please sign in to comment.