mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
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); |
|
} |
|
}
|
|
|