mirror of https://github.com/VERT-sh/VERT.git
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:
parent
ed851d8bd3
commit
d18fe38832
|
|
@ -31,6 +31,7 @@
|
||||||
"status": {
|
"status": {
|
||||||
"text": "<b>Status:</b> {status}",
|
"text": "<b>Status:</b> {status}",
|
||||||
"ready": "ready",
|
"ready": "ready",
|
||||||
|
"partially_ready": "partially ready",
|
||||||
"not_ready": "not ready",
|
"not_ready": "not ready",
|
||||||
"not_initialized": "not initialized",
|
"not_initialized": "not initialized",
|
||||||
"downloading": "downloading...",
|
"downloading": "downloading...",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import type {
|
||||||
SettingDefinition,
|
SettingDefinition,
|
||||||
} from "$lib/types/conversion-settings";
|
} 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 {
|
export class FormatInfo {
|
||||||
public name: string;
|
public name: string;
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,15 @@ export class MediabunnyConverter extends Converter {
|
||||||
// additional mediabunny coders
|
// additional mediabunny coders
|
||||||
// currently the official ones -- maybe add our own in the future
|
// currently the official ones -- maybe add our own in the future
|
||||||
this.initializeCodecs();
|
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> {
|
private async initializeCodecs(): Promise<void> {
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,23 @@
|
||||||
.filter((f) => f !== "none")
|
.filter((f) => f !== "none")
|
||||||
.join(", ");
|
.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 = {
|
output.Video = {
|
||||||
formats,
|
formats,
|
||||||
icon: Film,
|
icon: Film,
|
||||||
title: m["upload.cards.video"](),
|
title: m["upload.cards.video"](),
|
||||||
// TODO: add "partial" state? somehow figure out diff between vertd and mediabunny
|
status: videoStatus as WorkerStatus,
|
||||||
status: $vertdLoaded === true ? "ready" : "not-ready", // not using converter.status for this
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,6 +120,8 @@
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "downloading":
|
case "downloading":
|
||||||
return m["upload.cards.status.downloading"]();
|
return m["upload.cards.status.downloading"]();
|
||||||
|
case "partially-ready":
|
||||||
|
return m["upload.cards.status.partially_ready"]();
|
||||||
case "ready":
|
case "ready":
|
||||||
return m["upload.cards.status.ready"]();
|
return m["upload.cards.status.ready"]();
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
files,
|
files,
|
||||||
gradientColor,
|
gradientColor,
|
||||||
showGradient,
|
showGradient,
|
||||||
vertdLoaded,
|
|
||||||
dropdownStates,
|
dropdownStates,
|
||||||
} from "$lib/store/index.svelte";
|
} from "$lib/store/index.svelte";
|
||||||
import { VertFile } from "$lib/types";
|
import { VertFile } from "$lib/types";
|
||||||
|
|
@ -335,17 +334,6 @@
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</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}
|
{:else}
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue