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.
30 lines
850 B
30 lines
850 B
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); |
|
} |
|
} |