aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/pvr/guilib/PVRGUIActionsTimers.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/xbmc/pvr/guilib/PVRGUIActionsTimers.cpp b/xbmc/pvr/guilib/PVRGUIActionsTimers.cpp
index 582a3174f1..a247d46ec5 100644
--- a/xbmc/pvr/guilib/PVRGUIActionsTimers.cpp
+++ b/xbmc/pvr/guilib/PVRGUIActionsTimers.cpp
@@ -207,11 +207,17 @@ bool CPVRGUIActionsTimers::AddTimer(const CFileItem& item,
ParentalCheckResult::SUCCESS)
return false;
+ CDateTime gapStart;
+ int gapDuration{CPVRTimerInfoTag::DEFAULT_PVRRECORD_INSTANTRECORDTIME};
std::shared_ptr<CPVREpgInfoTag> epgTag = CPVRItem(item).GetEpgInfoTag();
if (epgTag)
{
if (epgTag->IsGapTag())
- epgTag.reset(); // for gap tags, we can only create instant timers
+ {
+ gapStart = epgTag->StartAsUTC();
+ gapDuration = (epgTag->EndAsUTC() - gapStart).GetSecondsTotal();
+ epgTag.reset(); // for gap tags, we can only create instant or time-based timers
+ }
}
else if (bCreateRule)
{
@@ -232,9 +238,28 @@ bool CPVRGUIActionsTimers::AddTimer(const CFileItem& item,
return false;
}
- std::shared_ptr<CPVRTimerInfoTag> newTimer(
- epgTag ? CPVRTimerInfoTag::CreateFromEpg(epgTag, bCreateRule)
- : CPVRTimerInfoTag::CreateInstantTimerTag(channel));
+ std::shared_ptr<CPVRTimerInfoTag> newTimer;
+ if (epgTag)
+ {
+ newTimer = CPVRTimerInfoTag::CreateFromEpg(epgTag, bCreateRule);
+ }
+ else if (gapStart.IsValid() &&
+ gapDuration != CPVRTimerInfoTag::DEFAULT_PVRRECORD_INSTANTRECORDTIME)
+ {
+ if (gapStart <= CDateTime::GetUTCDateTime())
+ gapStart = CDateTime{time_t{0}}; // special PVR addon API value for an instant recording
+
+ // prevent super long recordings for channels without any epg data
+ gapDuration = std::min(
+ m_settings.GetIntValue(CSettings::SETTING_PVRRECORD_INSTANTRECORDTIME) * 60, gapDuration);
+
+ newTimer = CPVRTimerInfoTag::CreateTimerTag(channel, gapStart, gapDuration);
+ }
+ else
+ {
+ newTimer = CPVRTimerInfoTag::CreateInstantTimerTag(channel);
+ }
+
if (!newTimer)
{
if (bCreateRule && bFallbackToOneShotTimer)