Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

feat: add "partially ready" status

Mayad18fe388324a
diff --git a/messages/en.json b/messages/en.json
index 73ce8d1..de1c67d 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -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...",
diff --git a/src/lib/converters/converter.svelte.ts b/src/lib/converters/converter.svelte.ts
index 10313eb..76a2315 100644
--- a/src/lib/converters/converter.svelte.ts
+++ b/src/lib/converters/converter.svelte.ts
@@ -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;
diff --git a/src/lib/converters/mediabunny.svelte.ts b/src/lib/converters/mediabunny.svelte.ts
index d0171c0..cf5a1a8 100644
--- a/src/lib/converters/mediabunny.svelte.ts
+++ b/src/lib/converters/mediabunny.svelte.ts
@@ -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> {
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 954ad0d..90a669d 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -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:
diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelte
index 533d1a3..d47f983 100644
--- a/src/routes/convert/+page.svelte
+++ b/src/routes/convert/+page.svelte
@@ -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