add yaml playout rewind instruction (#2243)
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ csharp_style_expression_bodied_constructors=true:none
|
||||
csharp_style_expression_bodied_methods=true:none
|
||||
csharp_style_expression_bodied_properties=true:suggestion
|
||||
csharp_style_var_elsewhere=false:suggestion
|
||||
csharp_style_var_for_built_in_types=false:suggestion
|
||||
csharp_style_var_for_built_in_types=false:none
|
||||
csharp_style_var_when_type_is_apparent=true:suggestion
|
||||
dotnet_naming_rule.local_constants_rule.severity=warning
|
||||
dotnet_naming_rule.local_constants_rule.style=all_upper_style
|
||||
|
||||
+6
-3
@@ -19,9 +19,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- With value of `true` and `sequence` property, will enable automatic post-roll for all content in the playout to the sequence with the provided key
|
||||
- With value of `false`, will disable automatic post-roll in the playout
|
||||
- YAML playout: add `mid_roll` instruction to enable and disable a mid-roll sequence
|
||||
- With value of `true` and `sequence` property, will enable automatic mid-roll for (`count` and `all`) content in the playout to the sequence with the provided key
|
||||
- With value of `false`, will disable automatic post-roll in the playout
|
||||
- `expression` can be used to influence which chapters are selected for mid roll (same as in filler preset)
|
||||
- With value of `true` and `sequence` property, will enable automatic mid-roll for (`count` and `all`) content in the playout to the sequence with the provided key
|
||||
- With value of `false`, will disable automatic post-roll in the playout
|
||||
- `expression` can be used to influence which chapters are selected for mid roll (same as in filler preset)
|
||||
- YAML playout: add `rewind` instruction to set start of playout relative to the current time
|
||||
- Value should be formatted as `HH:MM:SS` e.g. `00:05:30` for 5 minutes 30 seconds (before now)
|
||||
- This is instruction is mostly useful for debugging transitions, and can only be used as a reset instruction
|
||||
- Add YAML playout validation (using JSON Schema)
|
||||
- Invalid YAML playout definitions will fail to build and will log validation failures as warnings
|
||||
- `content` is fully validated
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using ErsatzTV.Core.Scheduling.YamlScheduling.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Handlers;
|
||||
|
||||
public class YamlPlayoutRewindHandler : IYamlPlayoutHandler
|
||||
{
|
||||
public bool Reset => true;
|
||||
|
||||
public Task<bool> Handle(
|
||||
YamlPlayoutContext context,
|
||||
YamlPlayoutInstruction instruction,
|
||||
PlayoutBuildMode mode,
|
||||
Func<string, Task> executeSequence,
|
||||
ILogger<YamlPlayoutBuilder> logger,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (instruction is not YamlPlayoutRewindInstruction rewind)
|
||||
{
|
||||
return Task.FromResult(false);
|
||||
}
|
||||
|
||||
if (TimeSpan.TryParse(rewind.Rewind ?? string.Empty, out TimeSpan amount))
|
||||
{
|
||||
context.CurrentTime -= amount;
|
||||
}
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Models;
|
||||
|
||||
public class YamlPlayoutRewindInstruction : YamlPlayoutInstruction
|
||||
{
|
||||
public string Rewind { get; set; }
|
||||
}
|
||||
@@ -349,6 +349,7 @@ public class YamlPlayoutBuilder(
|
||||
|
||||
YamlPlayoutSkipItemsInstruction => new YamlPlayoutSkipItemsHandler(enumeratorCache),
|
||||
YamlPlayoutSkipToItemInstruction => new YamlPlayoutSkipToItemHandler(enumeratorCache),
|
||||
YamlPlayoutRewindInstruction => new YamlPlayoutRewindHandler(),
|
||||
|
||||
// content handlers
|
||||
YamlPlayoutAllInstruction => new YamlPlayoutAllHandler(enumeratorCache),
|
||||
@@ -408,6 +409,7 @@ public class YamlPlayoutBuilder(
|
||||
{ "post_roll", typeof(YamlPostRollInstruction) },
|
||||
{ "mid_roll", typeof(YamlMidRollInstruction) },
|
||||
{ "repeat", typeof(YamlPlayoutRepeatInstruction) },
|
||||
{ "rewind", typeof(YamlPlayoutRewindInstruction) },
|
||||
{ "sequence", typeof(YamlPlayoutSequenceInstruction) },
|
||||
{ "shuffle_sequence", typeof(YamlPlayoutShuffleSequenceInstruction) },
|
||||
{ "skip_items", typeof(YamlPlayoutSkipItemsInstruction) },
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/control/rewindInstruction" },
|
||||
{ "$ref": "#/$defs/control/skipItemsInstruction" },
|
||||
{ "$ref": "#/$defs/control/skipToItemInstruction" },
|
||||
{ "$ref": "#/$defs/control/waitUntilInstruction" }
|
||||
@@ -284,6 +285,14 @@
|
||||
}
|
||||
},
|
||||
"control": {
|
||||
"rewindInstruction": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"rewind": { "type": "string" }
|
||||
},
|
||||
"required": [ "rewind" ],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"epgGroupInstruction": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user