Browse Source

yaml sequence improvements

pull/2053/head
Jason Dove 2 months ago
parent
commit
fd4dd57b41
No known key found for this signature in database
  1. 5
      CHANGELOG.md
  2. 1
      ErsatzTV.Core/Scheduling/YamlScheduling/Models/YamlPlayoutSequenceInstruction.cs
  3. 20
      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/).
- Add health check error when invalid VAAPI device and VAAPI driver combination is used in an active ffmpeg profile - 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 - This makes it obvious when hardware acceleration will not work as configured
- Add button in schedule editor to clone schedule item - 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 ### Changed
- Start to make UI minimally responsive (functional on smaller screens) - 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;
public class YamlPlayoutSequenceInstruction : YamlPlayoutInstruction public class YamlPlayoutSequenceInstruction : YamlPlayoutInstruction
{ {
public string Sequence { get; set; } public string Sequence { get; set; }
public int Repeat { get; set; }
} }

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

@ -127,7 +127,19 @@ public class YamlPlayoutBuilder(
} }
} }
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); FlattenSequences(context);
flattenCount++;
}
// handle all playout instructions // handle all playout instructions
while (context.CurrentTime < finish) while (context.CurrentTime < finish)
@ -204,10 +216,14 @@ public class YamlPlayoutBuilder(
.Filter(s => s.Key == sequenceInstruction.Sequence) .Filter(s => s.Key == sequenceInstruction.Sequence)
.HeadOrNone() .HeadOrNone()
.Map(s => s.Items) .Map(s => s.Items)
.Flatten(); .Flatten()
.ToList();
var sequenceGuid = Guid.NewGuid(); var sequenceGuid = Guid.NewGuid();
int repeat = sequenceInstruction.Repeat > 0 ? sequenceInstruction.Repeat : 1;
for (var r = 0; r < repeat; r++)
{
// insert all instructions from the sequence // insert all instructions from the sequence
foreach (YamlPlayoutInstruction i in sequenceInstructions) foreach (YamlPlayoutInstruction i in sequenceInstructions)
{ {
@ -223,6 +239,8 @@ public class YamlPlayoutBuilder(
context.Definition.Playout.Add(i); context.Definition.Playout.Add(i);
} }
}
break; break;
default: default:
context.Definition.Playout.Add(instruction); context.Definition.Playout.Add(instruction);

Loading…
Cancel
Save