58e11ba4e3
New "Video | Shorts" tab strip on the main page. The existing Video tab and its render pipeline are unchanged; Shorts is a new, independent workflow sharing the same render-progress/log/output controls. - Services/ShortsPipeline.cs: C# port of amigadb-short.sh rather than shelling out to bash — end users on plain Windows don't have bash/WSL, and shipping this as a native part of the app keeps distribution self-contained. All 19 visual style filtergraphs (brand, pixel, mirror, crop, workbench, blur, crt, copper, stars, grid, tiles, scan, starfield, plasma, rasterbars, vhs, monitor, split, spectrum) are copied verbatim from the bash heredocs. Per explicit decision, kept parity with the script's actual behavior where the brand-style HOOK_BOX_Y/INFO_BOX_Y/font-size variables are computed but never actually used in the final filter (dead code in the original) rather than "fixing" it and changing rendered output. Reuses ToolExtractor/MediaProbe/ProcessRunner exactly as RenderPipeline does, so FFmpeg resolution and NVENC fallback behave identically. - Models/ShortSettings.cs: job parameters + ShortStyle enum. - AppSettings gains sticky Shorts defaults (style, hook, website, font, background image, CRF, preset) alongside the existing Video defaults. - MainPage: Video/Shorts tab buttons toggle two content panels; the background-image field auto-hides for non-brand styles; font field defaults to the first bold system font found (Segoe UI Bold, Segoe UI Semibold, Arial Bold, Calibri Bold); blank output path is auto-derived from the input filename and style, matching the script's default. - 13 new unit tests (escaping order, meta-line joining, validation, every style producing a non-empty filter, the drawtext trailer's timing gates). Full run is 72/72 passing. - Fixed a bug caught during manual testing: MainPage.Resources["PrimaryButtonStyle"] looked in the Page's own (empty) resource dictionary instead of Application.Current.Resources, throwing on every tab switch. Verified end-to-end: rendered a real Short from an existing video through the actual running app (not just unit tests) and inspected extracted frames — hook/title/meta/website text overlays appear and disappear at the correct timestamps with correct styling. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
75 lines
3.5 KiB
C#
75 lines
3.5 KiB
C#
namespace AmiReel.Models;
|
|
|
|
/// <summary>
|
|
/// Persisted user settings (%LOCALAPPDATA%\AmiReel\settings.json). Uses named init
|
|
/// properties rather than a positional constructor: several members share the same
|
|
/// <see langword="string"/> type (e.g. TrimStart/FadeSeconds/EndCardHoldSeconds), so a
|
|
/// positional record would let two arguments be silently transposed at a call site
|
|
/// without the compiler catching it.
|
|
/// </summary>
|
|
public sealed record AppSettings
|
|
{
|
|
public required string OutputFolder { get; init; }
|
|
public required string EndCardPath { get; init; }
|
|
public required string FfmpegPath { get; init; }
|
|
public required string FfprobePath { get; init; }
|
|
public required string PreviewPlayerPath { get; init; }
|
|
public required string Theme { get; init; }
|
|
public required string Encoder { get; init; }
|
|
public required string TrimStart { get; init; }
|
|
public required string FadeSeconds { get; init; }
|
|
public required string EndCardHoldSeconds { get; init; }
|
|
public required string ThumbnailInterval { get; init; }
|
|
public bool? MoveSourcesToOriginals { get; init; }
|
|
|
|
// Shorts tab defaults (sticky across launches, same as the fields above).
|
|
public string ShortsStyle { get; init; } = "Brand";
|
|
public string ShortsHook { get; init; } = "THIS RAN ON AN AMIGA";
|
|
public string ShortsWebsite { get; init; } = "AMIGADB.NET";
|
|
public string ShortsFontFile { get; init; } = "";
|
|
public string ShortsBackgroundImage { get; init; } = "";
|
|
public string ShortsCrf { get; init; } = "16";
|
|
public string ShortsPreset { get; init; } = "slow";
|
|
|
|
public bool ShouldMoveSourcesToOriginals => MoveSourcesToOriginals != false;
|
|
|
|
public static AppSettings Default(string outputFolder) => new()
|
|
{
|
|
OutputFolder = outputFolder,
|
|
EndCardPath = "",
|
|
FfmpegPath = "",
|
|
FfprobePath = "",
|
|
PreviewPlayerPath = "",
|
|
Theme = "Dark",
|
|
Encoder = "Auto",
|
|
TrimStart = "4.414",
|
|
FadeSeconds = "3",
|
|
EndCardHoldSeconds = "4",
|
|
ThumbnailInterval = "10",
|
|
MoveSourcesToOriginals = true,
|
|
};
|
|
|
|
public AppSettings Normalize(string fallbackOutputFolder) => this with
|
|
{
|
|
OutputFolder = string.IsNullOrWhiteSpace(OutputFolder) ? fallbackOutputFolder : OutputFolder,
|
|
EndCardPath = EndCardPath ?? "",
|
|
FfmpegPath = FfmpegPath ?? "",
|
|
FfprobePath = FfprobePath ?? "",
|
|
PreviewPlayerPath = PreviewPlayerPath ?? "",
|
|
Theme = string.IsNullOrWhiteSpace(Theme) ? "Dark" : Theme,
|
|
Encoder = string.IsNullOrWhiteSpace(Encoder) ? "Auto" : Encoder,
|
|
TrimStart = string.IsNullOrWhiteSpace(TrimStart) ? "4.414" : TrimStart,
|
|
FadeSeconds = string.IsNullOrWhiteSpace(FadeSeconds) ? "3" : FadeSeconds,
|
|
EndCardHoldSeconds = string.IsNullOrWhiteSpace(EndCardHoldSeconds) ? "4" : EndCardHoldSeconds,
|
|
ThumbnailInterval = string.IsNullOrWhiteSpace(ThumbnailInterval) ? "10" : ThumbnailInterval,
|
|
MoveSourcesToOriginals = MoveSourcesToOriginals ?? true,
|
|
ShortsStyle = string.IsNullOrWhiteSpace(ShortsStyle) ? "Brand" : ShortsStyle,
|
|
ShortsHook = ShortsHook ?? "THIS RAN ON AN AMIGA",
|
|
ShortsWebsite = ShortsWebsite ?? "AMIGADB.NET",
|
|
ShortsFontFile = ShortsFontFile ?? "",
|
|
ShortsBackgroundImage = ShortsBackgroundImage ?? "",
|
|
ShortsCrf = string.IsNullOrWhiteSpace(ShortsCrf) ? "16" : ShortsCrf,
|
|
ShortsPreset = string.IsNullOrWhiteSpace(ShortsPreset) ? "slow" : ShortsPreset,
|
|
};
|
|
}
|