aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <3226626+ksooo@users.noreply.github.com>2024-10-07 21:50:46 +0200
committerGitHub <noreply@github.com>2024-10-07 21:50:46 +0200
commitbbdc81aacae7a18f8dedeb091e9e8523dec481f2 (patch)
tree90d9381582720f2347038192ffa2eaf817ba9e62
parent4b7921ce7c3d26edb52caa1013b1088e685787d1 (diff)
parentbb68e2fa6e280dbb9a9d9d79cc4cd9f327e016f0 (diff)
Merge pull request #25789 from ksooo/pvr-fix-start-recording-ctx-menu
[PVR] Context menu item 'Start recording': Fix to respect other runniā€¦
-rw-r--r--xbmc/pvr/PVRContextMenus.cpp52
1 files changed, 18 insertions, 34 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;
}
///////////////////////////////////////////////////////////////////////////////