feat: add "partially ready" status

checks if one or the other of mediabunny/vertd is ready and shows "partially ready"
This commit is contained in:
Maya 2026-03-10 21:40:17 +03:00
parent ed851d8bd3
commit d18fe38832
No known key found for this signature in database
5 changed files with 26 additions and 15 deletions

View File

@ -31,6 +31,7 @@
"status": {
"text": "<b>Status:</b> {status}",
"ready": "ready",
"partially_ready": "partially ready",
"not_ready": "not ready",
"not_initialized": "not initialized",
"downloading": "downloading...",

View File

@ -6,7 +6,7 @@ import type {
SettingDefinition,
} from "$lib/types/conversion-settings";
export type WorkerStatus = "not-ready" | "downloading" | "ready" | "error";
export type WorkerStatus = "not-ready" | "downloading" | "ready" | "partially-ready" | "error";
export class FormatInfo {
public name: string;

View File

@ -225,6 +225,15 @@ export class MediabunnyConverter extends Converter {
// additional mediabunny coders
// currently the official ones -- maybe add our own in the future
this.initializeCodecs();
// don't know how to check if mediabunny is ready rn, maybe test smol conversion or run some other method? shrug
if (typeof Conversion === "undefined") {
this.status = "not-ready";
this.error("Mediabunny failed to load");
} else {
this.status = "ready";
this.log("Mediabunny loaded successfully");
}
}
private async initializeCodecs(): Promise<void> {

View File

@ -75,12 +75,23 @@
.filter((f) => f !== "none")
.join(", ");
const mediabunnyStatus = converters.find(
(c) => c.name === "mediabunny",
)?.status;
const vertdReady = $vertdLoaded === true;
const mediabunnyReady = mediabunnyStatus === "ready";
const videoStatus =
vertdReady && mediabunnyReady
? "ready"
: vertdReady || mediabunnyReady
? "partially-ready"
: "not-ready";
output.Video = {
formats,
icon: Film,
title: m["upload.cards.video"](),
// TODO: add "partial" state? somehow figure out diff between vertd and mediabunny
status: $vertdLoaded === true ? "ready" : "not-ready", // not using converter.status for this
status: videoStatus as WorkerStatus,
};
}
@ -109,6 +120,8 @@
switch (status) {
case "downloading":
return m["upload.cards.status.downloading"]();
case "partially-ready":
return m["upload.cards.status.partially_ready"]();
case "ready":
return m["upload.cards.status.ready"]();
default:

View File

@ -15,7 +15,6 @@
files,
gradientColor,
showGradient,
vertdLoaded,
dropdownStates,
} from "$lib/store/index.svelte";
import { VertFile } from "$lib/types";
@ -335,17 +334,6 @@
})}
</p>
</div>
{:else if isVideo && !$vertdLoaded && !isAudio && !isImage && !isDocument}
<div
class="h-full flex flex-col text-center justify-center text-failure"
>
<p class="font-body font-bold">
{m["convert.errors.cant_convert"]()}
</p>
<p class="font-normal">
{m["convert.errors.vertd_not_found"]()}
</p>
</div>
{:else}
<div class="flex flex-row justify-between">
<div