Browse Source

yaml sequence improvements (#2053)

pull/2054/head
Jason Dove 2 days ago committed by GitHub
parent
commit
25f4fb22e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      CHANGELOG.md
  2. 1
      ErsatzTV.Core/Scheduling/YamlScheduling/Models/YamlPlayoutSequenceInstruction.cs
  3. 44
      ErsatzTV.Core/Scheduling/YamlScheduling/YamlPlayoutBuilder.cs

5
CHANGELOG.md

@ -35,6 +35,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -35,6 +35,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add health check error when invalid VAAPI device and VAAPI driver combination is used in an active ffmpeg profile
- This makes it obvious when hardware acceleration will not work as configured
- Add button in schedule editor to clone schedule item
- Allow YAML playout sequence definitions to reference other sequences
- Playout builder will behave in unexpected ways if nesting is too deep
- Add `repeat` property to YAML sequence instruction
- This tells the playout builder how many times this sequence should repeat
- Omitting this value is the same as setting it to `1`
### Changed
- Start to make UI minimally responsive (functional on smaller screens)

1
ErsatzTV.Core/Scheduling/YamlScheduling/Models/YamlPlayoutSequenceInstruction.cs

@ -3,4 +3,5 @@ namespace ErsatzTV.Core.Scheduling.YamlScheduling.Models; @@ -3,4 +3,5 @@ namespace ErsatzTV.Core.Scheduling.YamlScheduling.Models;
public class YamlPlayoutSequenceInstruction : YamlPlayoutInstruction
{
public string Sequence { get; set; }
public int Repeat { get; set; }
}

44
ErsatzTV.Core/Scheduling/YamlScheduling/YamlPlayoutBuilder.cs

@ -127,7 +127,19 @@ public class YamlPlayoutBuilder( @@ -127,7 +127,19 @@ public class YamlPlayoutBuilder(
}
}
FlattenSequences(context);
int flattenCount = 0;
while (context.Definition.Playout.Any(x => x is YamlPlayoutSequenceInstruction))
{
if (flattenCount > 10)
{
logger.LogError(
"YAML playout definition contains sequence nesting that is too deep; this introduces undefined behavior");
break;
}
FlattenSequences(context);
flattenCount++;
}
// handle all playout instructions
while (context.CurrentTime < finish)
@ -204,25 +216,31 @@ public class YamlPlayoutBuilder( @@ -204,25 +216,31 @@ public class YamlPlayoutBuilder(
.Filter(s => s.Key == sequenceInstruction.Sequence)
.HeadOrNone()
.Map(s => s.Items)
.Flatten();
.Flatten()
.ToList();
var sequenceGuid = Guid.NewGuid();
int repeat = sequenceInstruction.Repeat > 0 ? sequenceInstruction.Repeat : 1;
// insert all instructions from the sequence
foreach (YamlPlayoutInstruction i in sequenceInstructions)
for (var r = 0; r < repeat; r++)
{
// used for shuffling
i.SequenceKey = sequenceInstruction.Sequence;
i.SequenceGuid = sequenceGuid;
// copy custom title
if (!string.IsNullOrWhiteSpace(sequenceInstruction.CustomTitle))
// insert all instructions from the sequence
foreach (YamlPlayoutInstruction i in sequenceInstructions)
{
i.CustomTitle = sequenceInstruction.CustomTitle;
}
// used for shuffling
i.SequenceKey = sequenceInstruction.Sequence;
i.SequenceGuid = sequenceGuid;
// copy custom title
if (!string.IsNullOrWhiteSpace(sequenceInstruction.CustomTitle))
{
i.CustomTitle = sequenceInstruction.CustomTitle;
}
context.Definition.Playout.Add(i);
context.Definition.Playout.Add(i);
}
}
break;
default:
context.Definition.Playout.Add(instruction);

Loading…
Cancel
Save