feat: migrate legacy playout workflow and scenes

This commit is contained in:
2026-07-10 23:58:45 +09:00
parent 491a740505
commit 8dae7b8e0d
128 changed files with 39177 additions and 205 deletions

View File

@@ -1,6 +1,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using MBN_STOCK_WEBVIEW.Core.Playout;
using MBN_STOCK_WEBVIEW.Core.Playout.Scenes;
namespace MBN_STOCK_WEBVIEW.Playout.Configuration;
@@ -73,13 +74,30 @@ public static class PlayoutOptionsLoader
private static void ApplyEnvironment(PlayoutOptions options)
{
ApplyEnum("MBN_STOCK_PLAYOUT_MODE", value => options.Mode = value);
ApplyEnum(
"MBN_STOCK_PLAYOUT_MODE",
(PlayoutMode value) => options.Mode = value);
ApplyString("MBN_STOCK_PLAYOUT_HOST", value => options.Host = value);
ApplyInt("MBN_STOCK_PLAYOUT_PORT", value => options.Port = value);
ApplyInt("MBN_STOCK_PLAYOUT_TCP_MODE", value => options.TcpMode = value);
ApplyInt("MBN_STOCK_PLAYOUT_CLIENT_PORT", value => options.ClientPort = value);
ApplyNullableInt("MBN_STOCK_PLAYOUT_OUTPUT_CHANNEL", value => options.OutputChannel = value);
ApplyInt("MBN_STOCK_PLAYOUT_LAYOUT_INDEX", value => options.LayoutIndex = value);
ApplyInt(
"MBN_STOCK_PLAYOUT_LEGACY_FADE_DURATION",
value => options.LegacySceneFadeDuration = value);
ApplyEnum(
"MBN_STOCK_PLAYOUT_LEGACY_BACKGROUND_KIND",
(LegacySceneBackgroundKind value) => options.LegacySceneBackgroundKind = value);
ApplyString(
"MBN_STOCK_PLAYOUT_LEGACY_BACKGROUND_ASSET",
value => options.LegacySceneBackgroundAssetPath = value);
ApplyInt(
"MBN_STOCK_PLAYOUT_LEGACY_BACKGROUND_VIDEO_LOOP_COUNT",
value => options.LegacySceneBackgroundVideoLoopCount = value);
ApplyBool(
"MBN_STOCK_PLAYOUT_LEGACY_BACKGROUND_VIDEO_LOOP_INFINITE",
value => options.LegacySceneBackgroundVideoLoopInfinite = value);
ApplyString("MBN_STOCK_PLAYOUT_SCENE_DIRECTORY", value => options.SceneDirectory = value);
ApplyString(
"MBN_STOCK_PLAYOUT_TEST_WINDOW_TITLE_PATTERN",
@@ -177,7 +195,8 @@ public static class PlayoutOptionsLoader
apply(value);
}
private static void ApplyEnum(string name, Action<PlayoutMode> apply)
private static void ApplyEnum<TEnum>(string name, Action<TEnum> apply)
where TEnum : struct, Enum
{
var text = Environment.GetEnvironmentVariable(name);
if (string.IsNullOrWhiteSpace(text))
@@ -185,7 +204,7 @@ public static class PlayoutOptionsLoader
return;
}
if (!Enum.TryParse<PlayoutMode>(text, true, out var value))
if (!Enum.TryParse<TEnum>(text, true, out var value) || !Enum.IsDefined(value))
{
throw InvalidEnvironment(name);
}