replace new_epg_group instruction with epg_group; copy sequence custom title to sequence items
This commit is contained in:
+11
-3
@@ -3,7 +3,7 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Handlers;
|
||||
|
||||
public class YamlPlayoutNewEpgGroupHandler : IYamlPlayoutHandler
|
||||
public class YamlPlayoutEpgGroupHandler : IYamlPlayoutHandler
|
||||
{
|
||||
public bool Reset => false;
|
||||
|
||||
@@ -13,12 +13,20 @@ public class YamlPlayoutNewEpgGroupHandler : IYamlPlayoutHandler
|
||||
ILogger<YamlPlayoutBuilder> logger,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (instruction is not YamlPlayoutNewEpgGroupInstruction)
|
||||
if (instruction is not YamlPlayoutEpgGroupInstruction epgGroup)
|
||||
{
|
||||
return Task.FromResult(false);
|
||||
}
|
||||
|
||||
// context.NextGuideGroup() *= -1;
|
||||
if (epgGroup.EpgGroup)
|
||||
{
|
||||
context.LockGuideGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
context.UnlockGuideGroup();
|
||||
}
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Models;
|
||||
|
||||
public class YamlPlayoutEpgGroupInstruction : YamlPlayoutInstruction
|
||||
{
|
||||
[YamlMember(Alias = "epg_group", ApplyNamingConventions = false)]
|
||||
public bool EpgGroup { get; set; }
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Models;
|
||||
|
||||
public class YamlPlayoutNewEpgGroupInstruction : YamlPlayoutInstruction
|
||||
{
|
||||
[YamlMember(Alias = "new_epg_group", ApplyNamingConventions = false)]
|
||||
public string NewEpgGroup { get; set; }
|
||||
}
|
||||
@@ -213,6 +213,12 @@ public class YamlPlayoutBuilder(
|
||||
i.SequenceKey = sequenceInstruction.Sequence;
|
||||
i.SequenceGuid = sequenceGuid;
|
||||
|
||||
// copy custom title
|
||||
if (!string.IsNullOrWhiteSpace(sequenceInstruction.CustomTitle))
|
||||
{
|
||||
i.CustomTitle = sequenceInstruction.CustomTitle;
|
||||
}
|
||||
|
||||
context.Definition.Playout.Add(i);
|
||||
}
|
||||
break;
|
||||
@@ -237,7 +243,7 @@ public class YamlPlayoutBuilder(
|
||||
{
|
||||
YamlPlayoutRepeatInstruction => new YamlPlayoutRepeatHandler(),
|
||||
YamlPlayoutWaitUntilInstruction => new YamlPlayoutWaitUntilHandler(),
|
||||
YamlPlayoutNewEpgGroupInstruction => new YamlPlayoutNewEpgGroupHandler(),
|
||||
YamlPlayoutEpgGroupInstruction => new YamlPlayoutEpgGroupHandler(),
|
||||
YamlPlayoutShuffleSequenceInstruction => new YamlPlayoutShuffleSequenceHandler(),
|
||||
|
||||
YamlPlayoutSkipItemsInstruction => new YamlPlayoutSkipItemsHandler(enumeratorCache),
|
||||
@@ -285,7 +291,7 @@ public class YamlPlayoutBuilder(
|
||||
{ "all", typeof(YamlPlayoutAllInstruction) },
|
||||
{ "count", typeof(YamlPlayoutCountInstruction) },
|
||||
{ "duration", typeof(YamlPlayoutDurationInstruction) },
|
||||
{ "new_epg_group", typeof(YamlPlayoutNewEpgGroupInstruction) },
|
||||
{ "epg_group", typeof(YamlPlayoutEpgGroupInstruction) },
|
||||
{ "pad_to_next", typeof(YamlPlayoutPadToNextInstruction) },
|
||||
{ "pad_until", typeof(YamlPlayoutPadUntilInstruction) },
|
||||
{ "repeat", typeof(YamlPlayoutRepeatInstruction) },
|
||||
|
||||
@@ -7,6 +7,7 @@ public class YamlPlayoutContext(Playout playout, YamlPlayoutDefinition definitio
|
||||
{
|
||||
private readonly System.Collections.Generic.HashSet<int> _visitedInstructions = [];
|
||||
private int _instructionIndex;
|
||||
private bool _guideGroupLocked;
|
||||
|
||||
public Playout Playout { get; } = playout;
|
||||
|
||||
@@ -28,6 +29,11 @@ public class YamlPlayoutContext(Playout playout, YamlPlayoutDefinition definitio
|
||||
|
||||
public int NextGuideGroup()
|
||||
{
|
||||
if (_guideGroupLocked)
|
||||
{
|
||||
return guideGroup;
|
||||
}
|
||||
|
||||
guideGroup++;
|
||||
if (guideGroup > 1000)
|
||||
{
|
||||
@@ -36,4 +42,15 @@ public class YamlPlayoutContext(Playout playout, YamlPlayoutDefinition definitio
|
||||
|
||||
return guideGroup;
|
||||
}
|
||||
|
||||
public void LockGuideGroup()
|
||||
{
|
||||
NextGuideGroup();
|
||||
_guideGroupLocked = true;
|
||||
}
|
||||
|
||||
public void UnlockGuideGroup()
|
||||
{
|
||||
_guideGroupLocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user