Stream custom live channels using your own media
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
905 B

using ErsatzTV.Core.Domain.Scheduling;
namespace ErsatzTV.Core.Scheduling;
public static class PlayoutTemplateSelector
{
public static Option<PlayoutTemplate> GetPlayoutTemplateFor(
IEnumerable<PlayoutTemplate> templates,
DateTimeOffset date)
{
foreach (PlayoutTemplate template in templates.OrderBy(x => x.Index))
{
bool daysOfWeek = template.DaysOfWeek.Contains(date.DayOfWeek);
if (!daysOfWeek)
{
continue;
}
bool daysOfMonth = template.DaysOfMonth.Contains(date.Day);
if (!daysOfMonth)
{
continue;
}
bool monthOfYear = template.MonthsOfYear.Contains(date.Month);
if (monthOfYear)
{
return template;
}
}
return Option<PlayoutTemplate>.None;
}
}