mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* refactor filler expression * add yaml mid roll instruction * schedule midroll for yaml count and all instructions * update changelogpull/2233/head
13 changed files with 154 additions and 13 deletions
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
using ErsatzTV.Core.Scheduling.YamlScheduling.Models; |
||||
using Microsoft.Extensions.Logging; |
||||
|
||||
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Handlers; |
||||
|
||||
public class YamlPlayoutMidRollHandler : IYamlPlayoutHandler |
||||
{ |
||||
public bool Reset => false; |
||||
|
||||
public Task<bool> Handle( |
||||
YamlPlayoutContext context, |
||||
YamlPlayoutInstruction instruction, |
||||
PlayoutBuildMode mode, |
||||
Func<string, Task> executeSequence, |
||||
ILogger<YamlPlayoutBuilder> logger, |
||||
CancellationToken cancellationToken) |
||||
{ |
||||
if (instruction is not YamlMidRollInstruction midRoll) |
||||
{ |
||||
return Task.FromResult(false); |
||||
} |
||||
|
||||
if (midRoll.MidRoll && !string.IsNullOrWhiteSpace(midRoll.Sequence) && !string.IsNullOrWhiteSpace(midRoll.Expression)) |
||||
{ |
||||
context.SetMidRollSequence(new YamlPlayoutContext.MidRollSequence(midRoll.Sequence, midRoll.Expression)); |
||||
} |
||||
else |
||||
{ |
||||
context.ClearMidRollSequence(); |
||||
} |
||||
|
||||
return Task.FromResult(true); |
||||
} |
||||
} |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
using YamlDotNet.Serialization; |
||||
|
||||
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Models; |
||||
|
||||
public class YamlMidRollInstruction : YamlPlayoutInstruction |
||||
{ |
||||
[YamlMember(Alias = "mid_roll", ApplyNamingConventions = false)] |
||||
public bool MidRoll { get; set; } |
||||
|
||||
public string Sequence { get; set; } |
||||
|
||||
public string Expression { get; set; } = "true"; |
||||
} |
||||
Loading…
Reference in new issue