From b67b62c1547a80b78843a5915493dc0047cb9634 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 24 May 2026 09:42:48 +0200 Subject: [PATCH] Mirror SE5 contract: settingsVersion + video duration/resolution Adds the new optional fields published in subtitleedit#11142 to the three plugin-side PluginContract.cs mirrors (Plugin-Shared, TypewriterEffect, Haxor): PluginRequest: - VideoDurationSeconds (double?) - VideoWidth (int?) - VideoHeight (int?) - SettingsVersion (int?) PluginResponse: - SettingsVersion (int?) All fields are optional and null-safe: existing plugins compile and run unchanged, plugins on newer SE that don't write SettingsVersion behave as "unversioned" just like before. Co-Authored-By: Claude Opus 4.7 (1M context) --- se5/Haxor/PluginContract.cs | 22 ++++++++++++++++++++++ se5/Plugin-Shared/PluginContract.cs | 25 +++++++++++++++++++++++++ se5/TypewriterEffect/PluginContract.cs | 23 +++++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/se5/Haxor/PluginContract.cs b/se5/Haxor/PluginContract.cs index 9be97cc1..d9a9cbda 100644 --- a/se5/Haxor/PluginContract.cs +++ b/se5/Haxor/PluginContract.cs @@ -24,6 +24,16 @@ public sealed class PluginRequest public string VideoFileName { get; set; } = string.Empty; public double FrameRate { get; set; } + + /// Total video duration in seconds. Null when no video is loaded or on older SE versions. + public double? VideoDurationSeconds { get; set; } + + /// Video frame width in pixels. Null when no video is loaded or on older SE versions. + public int? VideoWidth { get; set; } + + /// Video frame height in pixels. Null when no video is loaded or on older SE versions. + public int? VideoHeight { get; set; } + public string UiLanguage { get; set; } = string.Empty; public string Theme { get; set; } = string.Empty; @@ -34,6 +44,12 @@ public sealed class PluginRequest /// This plugin's settings as last persisted by Subtitle Edit (null on first run). public JsonElement? Settings { get; set; } + + /// + /// Schema version this plugin attached to in its last response. + /// Null on first run, when settings were saved without a version, or on older SE versions. + /// + public int? SettingsVersion { get; set; } } /// Active theme colors. All values are #AARRGGBB hex strings. @@ -78,5 +94,11 @@ public sealed class PluginResponse /// Settings to persist; handed back unchanged in the next request. public JsonElement? Settings { get; set; } + /// + /// Schema version for . Bump when you change the shape of your + /// settings so you can migrate or reset on the next run. Optional; null = "unversioned". + /// + public int? SettingsVersion { get; set; } + public string? UndoDescription { get; set; } } diff --git a/se5/Plugin-Shared/PluginContract.cs b/se5/Plugin-Shared/PluginContract.cs index 00147bd6..061e791d 100644 --- a/se5/Plugin-Shared/PluginContract.cs +++ b/se5/Plugin-Shared/PluginContract.cs @@ -16,6 +16,16 @@ public sealed class PluginRequest public List SelectedIndices { get; set; } = new(); public string VideoFileName { get; set; } = string.Empty; public double FrameRate { get; set; } + + /// Total video duration in seconds. Null when no video is loaded or on older SE versions. + public double? VideoDurationSeconds { get; set; } + + /// Video frame width in pixels. Null when no video is loaded or on older SE versions. + public int? VideoWidth { get; set; } + + /// Video frame height in pixels. Null when no video is loaded or on older SE versions. + public int? VideoHeight { get; set; } + public string UiLanguage { get; set; } = string.Empty; public string Theme { get; set; } = string.Empty; @@ -24,6 +34,13 @@ public sealed class PluginRequest public string SeVersion { get; set; } = string.Empty; public JsonElement? Settings { get; set; } + + /// + /// Schema version this plugin attached to in its last response. + /// Null on first run, when settings were saved without a version, or on older SE versions. + /// Use it to migrate or reset settings written by an older build of this plugin. + /// + public int? SettingsVersion { get; set; } } /// Active theme colors. All values are #AARRGGBB hex strings. @@ -53,6 +70,14 @@ public sealed class PluginResponse public string? Message { get; set; } public PluginSubtitle? Subtitle { get; set; } public JsonElement? Settings { get; set; } + + /// + /// Schema version for . Bump when you change the shape of your + /// settings so you can detect (and migrate or reset) stale data on the next run via + /// . Optional; null = "unversioned". + /// + public int? SettingsVersion { get; set; } + public string? UndoDescription { get; set; } } diff --git a/se5/TypewriterEffect/PluginContract.cs b/se5/TypewriterEffect/PluginContract.cs index aa497852..121af386 100644 --- a/se5/TypewriterEffect/PluginContract.cs +++ b/se5/TypewriterEffect/PluginContract.cs @@ -15,6 +15,16 @@ public sealed class PluginRequest public List SelectedIndices { get; set; } = new(); public string VideoFileName { get; set; } = string.Empty; public double FrameRate { get; set; } + + /// Total video duration in seconds. Null when no video is loaded or on older SE versions. + public double? VideoDurationSeconds { get; set; } + + /// Video frame width in pixels. Null when no video is loaded or on older SE versions. + public int? VideoWidth { get; set; } + + /// Video frame height in pixels. Null when no video is loaded or on older SE versions. + public int? VideoHeight { get; set; } + public string UiLanguage { get; set; } = string.Empty; public string Theme { get; set; } = string.Empty; @@ -23,6 +33,12 @@ public sealed class PluginRequest public string SeVersion { get; set; } = string.Empty; public JsonElement? Settings { get; set; } + + /// + /// Schema version this plugin attached to in its last response. + /// Null on first run, when settings were saved without a version, or on older SE versions. + /// + public int? SettingsVersion { get; set; } } /// Active theme colors. All values are #AARRGGBB hex strings. @@ -52,5 +68,12 @@ public sealed class PluginResponse public string? Message { get; set; } public PluginSubtitle? Subtitle { get; set; } public JsonElement? Settings { get; set; } + + /// + /// Schema version for . Bump when you change the shape of your + /// settings so you can migrate or reset on the next run. Optional; null = "unversioned". + /// + public int? SettingsVersion { get; set; } + public string? UndoDescription { get; set; } }