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.
33 lines
912 B
33 lines
912 B
using ErsatzTV.Core.Scheduling.YamlScheduling.Models; |
|
using Microsoft.Extensions.Logging; |
|
|
|
namespace ErsatzTV.Core.Scheduling.YamlScheduling.Handlers; |
|
|
|
public class YamlPlayoutSkipItemsHandler : IYamlPlayoutHandler |
|
{ |
|
public bool Reset => true; |
|
|
|
public Task<bool> Handle( |
|
YamlPlayoutContext context, |
|
YamlPlayoutInstruction instruction, |
|
ILogger<YamlPlayoutBuilder> logger, |
|
CancellationToken cancellationToken) |
|
{ |
|
if (instruction is not YamlPlayoutSkipItemsInstruction skipItems) |
|
{ |
|
return Task.FromResult(false); |
|
} |
|
|
|
if (context.ContentIndex.TryGetValue(skipItems.Content, out int value)) |
|
{ |
|
value += skipItems.SkipItems; |
|
} |
|
else |
|
{ |
|
value = skipItems.SkipItems; |
|
} |
|
|
|
context.ContentIndex[skipItems.Content] = value; |
|
return Task.FromResult(true); |
|
} |
|
}
|
|
|