From 11100a788bc9d945dd704c4fdda6db88086aa75b Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Mon, 4 Aug 2025 22:22:37 +0000 Subject: [PATCH] fix yaml guid validation (#2257) --- .../Channels/Commands/CreateChannelHandler.cs | 2 +- .../Channels/Commands/UpdateChannelHandler.cs | 2 +- ErsatzTV/Pages/ChannelEditor.razor | 4 ++-- ErsatzTV/Resources/yaml-playout-import.schema.json | 4 ++-- ErsatzTV/Resources/yaml-playout.schema.json | 4 ++-- ErsatzTV/Validators/ChannelEditViewModelValidator.cs | 9 +++++++++ 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs b/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs index cbe08f267..01cd3ba04 100644 --- a/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs +++ b/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs @@ -91,7 +91,7 @@ public class CreateChannelHandler( TranscodeMode = request.TranscodeMode, IdleBehavior = request.IdleBehavior, IsEnabled = request.IsEnabled, - ShowInEpg = request.ShowInEpg + ShowInEpg = request.IsEnabled && request.ShowInEpg }; foreach (int id in watermarkId) diff --git a/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs b/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs index 55fbaf939..128e05a7b 100644 --- a/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs +++ b/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs @@ -46,7 +46,7 @@ public class UpdateChannelHandler( c.TranscodeMode = update.TranscodeMode; c.IdleBehavior = update.IdleBehavior; c.IsEnabled = update.IsEnabled; - c.ShowInEpg = update.ShowInEpg; + c.ShowInEpg = update.IsEnabled && update.ShowInEpg; c.Artwork ??= []; if (!string.IsNullOrWhiteSpace(update.Logo?.Path)) diff --git a/ErsatzTV/Pages/ChannelEditor.razor b/ErsatzTV/Pages/ChannelEditor.razor index f5050f6be..4655b9bb2 100644 --- a/ErsatzTV/Pages/ChannelEditor.razor +++ b/ErsatzTV/Pages/ChannelEditor.razor @@ -80,13 +80,13 @@
Is Enabled
- +
Show In EPG
- +
diff --git a/ErsatzTV/Resources/yaml-playout-import.schema.json b/ErsatzTV/Resources/yaml-playout-import.schema.json index 9a4f1b922..65527a082 100644 --- a/ErsatzTV/Resources/yaml-playout-import.schema.json +++ b/ErsatzTV/Resources/yaml-playout-import.schema.json @@ -80,7 +80,7 @@ "type": "object", "properties": { "source": { "type": "string" }, - "value": { "type": "string" } + "value": { "type": ["integer", "string"] } }, "required": [ "source", "value" ], "additionalProperties": false @@ -154,7 +154,7 @@ "type": "object", "properties": { "source": { "type": "string" }, - "value": { "type": "string" } + "value": { "type": ["integer", "string"] } }, "required": [ "source", "value" ], "additionalProperties": false diff --git a/ErsatzTV/Resources/yaml-playout.schema.json b/ErsatzTV/Resources/yaml-playout.schema.json index 82a0fee68..c169afb6c 100644 --- a/ErsatzTV/Resources/yaml-playout.schema.json +++ b/ErsatzTV/Resources/yaml-playout.schema.json @@ -124,7 +124,7 @@ "type": "object", "properties": { "source": { "type": "string" }, - "value": { "type": "string" } + "value": { "type": ["integer", "string"] } }, "required": [ "source", "value" ], "additionalProperties": false @@ -198,7 +198,7 @@ "type": "object", "properties": { "source": { "type": "string" }, - "value": { "type": "string" } + "value": { "type": ["integer", "string"] } }, "required": [ "source", "value" ], "additionalProperties": false diff --git a/ErsatzTV/Validators/ChannelEditViewModelValidator.cs b/ErsatzTV/Validators/ChannelEditViewModelValidator.cs index b9125d1ca..42a2e9ad7 100644 --- a/ErsatzTV/Validators/ChannelEditViewModelValidator.cs +++ b/ErsatzTV/Validators/ChannelEditViewModelValidator.cs @@ -24,6 +24,15 @@ public class ChannelEditViewModelValidator : AbstractValidator x.IsEnabled == false, + () => + { + RuleFor(x => x.ShowInEpg) + .Must(x => x == false) + .WithMessage("Disabled channels cannot be shown in EPG"); + }); } public Func>> ValidateValue => async (model, propertyName) =>