From 32f93d74bb9eef3cbd7e7f05788082e9240e5af3 Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Sun, 30 Nov 2025 15:30:30 -0500 Subject: [PATCH] Remove recurring and years properties and instead implicitly derive from start and end date --- .../Models/YamlPlayoutSchedule.cs | 10 ---------- .../SequentialPlayoutBuilder.cs | 19 +++---------------- .../Resources/sequential-schedule.schema.json | 11 +---------- 3 files changed, 4 insertions(+), 36 deletions(-) diff --git a/ErsatzTV.Core/Scheduling/YamlScheduling/Models/YamlPlayoutSchedule.cs b/ErsatzTV.Core/Scheduling/YamlScheduling/Models/YamlPlayoutSchedule.cs index e97aa2fa0..33ac51f6c 100644 --- a/ErsatzTV.Core/Scheduling/YamlScheduling/Models/YamlPlayoutSchedule.cs +++ b/ErsatzTV.Core/Scheduling/YamlScheduling/Models/YamlPlayoutSchedule.cs @@ -12,16 +12,6 @@ public class YamlPlayoutSchedule [YamlMember(Alias = "end_date", ApplyNamingConventions = false)] public string EndDate { get; set; } - /// - /// Specific year(s) this schedule applies to. If empty, applies to all years. - /// - public List Years { get; set; } = []; - - /// - /// Whether this schedule repeats annually (default: true when no years are specified) - /// - public bool Recurring { get; set; } = true; - public List Reset { get; set; } = []; public List Playout { get; set; } = []; diff --git a/ErsatzTV.Core/Scheduling/YamlScheduling/SequentialPlayoutBuilder.cs b/ErsatzTV.Core/Scheduling/YamlScheduling/SequentialPlayoutBuilder.cs index d8da693d6..2e9efb258 100644 --- a/ErsatzTV.Core/Scheduling/YamlScheduling/SequentialPlayoutBuilder.cs +++ b/ErsatzTV.Core/Scheduling/YamlScheduling/SequentialPlayoutBuilder.cs @@ -779,23 +779,10 @@ public class SequentialPlayoutBuilder( int currentMonth = date.Month; int currentDay = date.Day; - // Check if years are specified - if (schedule.Years.Count > 0) - { - if (!schedule.Years.Contains(currentYear)) - { - return false; - } - } - else if (!schedule.Recurring) - { - // If not recurring and no years specified, the schedule doesn't apply - return false; - } - - // Handle year-specific dates + // Handle year-specific dates (YYYY-MM-DD format) if (startYear.HasValue && endYear.HasValue) { + // Dates with years are always non-recurring (one-time events) var startDate = new DateTime(startYear.Value, startMonth, startDay); var endDate = new DateTime(endYear.Value, endMonth, endDay); var currentDate = new DateTime(currentYear, currentMonth, currentDay); @@ -809,7 +796,7 @@ public class SequentialPlayoutBuilder( return false; } - // Both dates are MM-DD format (recurring) + // Both dates are MM-DD format - always recurring var currentDayOfYear = new DateTime(currentYear, currentMonth, currentDay).DayOfYear; var startDayOfYear = new DateTime(currentYear, startMonth, startDay).DayOfYear; var endDayOfYear = new DateTime(currentYear, endMonth, endDay).DayOfYear; diff --git a/ErsatzTV/Resources/sequential-schedule.schema.json b/ErsatzTV/Resources/sequential-schedule.schema.json index dfa4d5157..10a13e6f4 100644 --- a/ErsatzTV/Resources/sequential-schedule.schema.json +++ b/ErsatzTV/Resources/sequential-schedule.schema.json @@ -83,18 +83,9 @@ }, "end_date": { "type": "string", - "description": "End date in MM-DD (e.g., '01-31') or YYYY-MM-DD format (e.g., '2024-12-25')", + "description": "End date in MM-DD (e.g., '01-31') or YYYY-MM-DD format (e.g., '2024-12-25'). MM-DD dates recur annually, YYYY-MM-DD dates are one-time events.", "pattern": "^((\\d{4}-)?(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]))$" }, - "years": { - "type": "array", - "items": { "type": "integer" }, - "description": "Specific years this schedule applies to. If empty, applies to all years (when recurring is true)." - }, - "recurring": { - "type": "boolean", - "description": "Whether this schedule repeats annually (default: true when no years are specified)" - }, "reset": { "description": "Reset instructions for this scheduled playout", "type": "array",