refactor: dedupe resolution presets and clean up 4k stack

This commit is contained in:
James
2026-05-07 16:58:26 +00:00
parent bc02b8810c
commit 2b2281d490
12 changed files with 116 additions and 121 deletions
+5 -28
View File
@@ -36,34 +36,11 @@ import { fetchRemoteTemplate } from "../templates/remote.js";
import { trackInitTemplate } from "../telemetry/events.js";
import { hasFFmpeg } from "../whisper/manager.js";
import { VERSION } from "../version.js";
import { CANVAS_DIMENSIONS, type CanvasResolution } from "@hyperframes/core";
const VALID_RESOLUTIONS: readonly CanvasResolution[] = [
"landscape",
"portrait",
"landscape-4k",
"portrait-4k",
] as const;
const RESOLUTION_ALIASES: Record<string, CanvasResolution> = {
"1080p": "landscape",
hd: "landscape",
"1080p-portrait": "portrait",
"portrait-1080p": "portrait",
"4k": "landscape-4k",
uhd: "landscape-4k",
"4k-portrait": "portrait-4k",
"portrait-4k": "portrait-4k",
};
function normalizeResolutionFlag(input: string | undefined): CanvasResolution | undefined {
if (!input) return undefined;
const lowered = input.toLowerCase();
if ((VALID_RESOLUTIONS as readonly string[]).includes(lowered)) {
return lowered as CanvasResolution;
}
return RESOLUTION_ALIASES[lowered];
}
import {
CANVAS_DIMENSIONS,
normalizeResolutionFlag,
type CanvasResolution,
} from "@hyperframes/core";
interface VideoMeta {
durationSeconds: number;