mirror of https://github.com/VERT-sh/VERT.git
chore: re-organize structure a bit
This commit is contained in:
parent
9b0470e4de
commit
95210e84eb
|
|
@ -8,7 +8,7 @@
|
|||
import { onMount } from "svelte";
|
||||
import { quintOut } from "svelte/easing";
|
||||
import { VertFile } from "$lib/types";
|
||||
import SettingsModal from "./SettingsModal.svelte";
|
||||
import SettingsModal from "./popups/SettingsModal.svelte";
|
||||
import { log } from "$lib/util/logger";
|
||||
|
||||
type Props = {
|
||||
|
|
@ -279,7 +279,7 @@
|
|||
});
|
||||
const ext = filename.split(".").pop() ?? "";
|
||||
return new VertFile(f, ext);
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<script lang="ts">
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { SearchIcon } from "lucide-svelte";
|
||||
import Dropdown from "./Dropdown.svelte";
|
||||
import FancyInput from "./FancyInput.svelte";
|
||||
import Dropdown from "../Dropdown.svelte";
|
||||
import FancyInput from "../FancyInput.svelte";
|
||||
import Modal from "./Modal.svelte";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import type { VertFile } from "$lib/types";
|
||||
|
|
@ -31,8 +31,9 @@
|
|||
submitting = true;
|
||||
try {
|
||||
await submitInner();
|
||||
} catch (e) {}
|
||||
submitting = false;
|
||||
} finally {
|
||||
submitting = false;
|
||||
}
|
||||
};
|
||||
|
||||
const submitInner = async () => {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { duration, fade } from "$lib/util/animation";
|
||||
import { quintOut } from "svelte/easing";
|
||||
import Dialog from "../functional/Dialog.svelte";
|
||||
import Dialog from "../functional/popups/Dialog.svelte";
|
||||
import {
|
||||
type Dialog as DialogType,
|
||||
dialogs,
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ import {
|
|||
WEBM,
|
||||
WebMOutputFormat,
|
||||
} from "mediabunny";
|
||||
import { registerMp3Encoder } from "@mediabunny/mp3-encoder";
|
||||
import { registerAc3Decoder, registerAc3Encoder } from "@mediabunny/ac3";
|
||||
import { registerMp3Encoder } from "@mediabunny/mp3-encoder";
|
||||
import { registerFlacEncoder } from "@mediabunny/flac-encoder";
|
||||
import { Converter, FormatInfo, type WorkerStatus } from "./converter.svelte";
|
||||
import { ToastManager } from "$lib/util/toast.svelte";
|
||||
import { error, log } from "$lib/util/logger";
|
||||
import { registerFlacEncoder } from "@mediabunny/flac-encoder";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import type {
|
||||
SettingDefinition,
|
||||
|
|
@ -32,6 +32,7 @@ import { CONVERSION_BITRATES, SAMPLE_RATES } from "./ffmpeg.svelte";
|
|||
|
||||
// codec compatibility object, based on docs
|
||||
// https://mediabunny.dev/guide/supported-formats-and-codecs#compatibility-table
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const codecCompatibility = {
|
||||
video: {
|
||||
mp4: ["avc", "hevc", "vp8", "vp9", "av1"],
|
||||
|
|
@ -200,7 +201,7 @@ export class MediabunnyConverter extends Converter {
|
|||
super();
|
||||
|
||||
// additional mediabunny coders
|
||||
// currently both official ones -- maybe add our own in the future
|
||||
// currently the official ones -- maybe add our own in the future
|
||||
this.initializeCodecs();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import VertdErrorComponent from "$lib/components/functional/VertdError.svelte";
|
||||
import VertdErrorComponent from "$lib/components/functional/popups/VertdError.svelte";
|
||||
import { error, log } from "$lib/util/logger";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import { Settings } from "$lib/sections/settings/index.svelte";
|
||||
|
|
|
|||
|
|
@ -142,14 +142,27 @@ export class VertFile {
|
|||
const customConverter = this.converters.find(
|
||||
(c) => c.name === this.conversionSettings.converter,
|
||||
);
|
||||
const converter =
|
||||
customConverter ||
|
||||
(this.isZip() // TODO: not sure if the zip needs to be changed now
|
||||
? this.converters[0]
|
||||
: this.findConverters([this.from, this.to])[0]);
|
||||
log(["file", "convert"], `using converter: ${converter.name}`);
|
||||
let converter = customConverter;
|
||||
|
||||
if (!converter) {
|
||||
const compatibleConverters = this.findConverters([
|
||||
this.from,
|
||||
this.to,
|
||||
]);
|
||||
if (compatibleConverters.length) {
|
||||
converter = compatibleConverters[0];
|
||||
log(["file", "convert"], `found compatible converter: ${converter.name}`);
|
||||
} else {
|
||||
log(["file", "convert"], `no compatible converter found for ${this.from} to ${this.to}`);
|
||||
// TODO: handle zip converter fallback explicitly if needed
|
||||
// TODO: provide a clearer error path for unsupported from/to pairs
|
||||
}
|
||||
} else {
|
||||
log(["file", "convert"], `using custom converter from settings: ${converter.name}`);
|
||||
}
|
||||
|
||||
if (!converter) throw new Error("No converter found");
|
||||
log(["file", "convert"], `using converter: ${converter.name}`);
|
||||
|
||||
this.result = null;
|
||||
this.progress = 0;
|
||||
|
|
|
|||
|
|
@ -64,12 +64,6 @@
|
|||
|
||||
const converter = getCurrentConverter(file);
|
||||
if (!converter) return;
|
||||
|
||||
// Initialize converter in settings if not already set
|
||||
if (!file.conversionSettings.converter)
|
||||
file.conversionSettings.converter = converter.name;
|
||||
|
||||
|
||||
let category: string | undefined;
|
||||
const isImage = converterCategories.image.includes(converter.name);
|
||||
const isAudio = converterCategories.audio.includes(converter.name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue