Skip to content

armgit / VERT

Public Imported from GitHub
0

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

fix: open native category first

Mayaf12968247473
diff --git a/src/lib/components/functional/FormatDropdown.svelte b/src/lib/components/functional/FormatDropdown.svelte
index efa8200..2dc23ff 100644
--- a/src/lib/components/functional/FormatDropdown.svelte
+++ b/src/lib/components/functional/FormatDropdown.svelte
@@ -8,9 +8,6 @@
import { onMount } from "svelte";
import { quintOut } from "svelte/easing";
import { VertFile } from "$lib/types";
- import Modal from "./Modal.svelte";
- import Dropdown from "./Dropdown.svelte";
- import FancyInput from "./FancyInput.svelte";
import SettingsModal from "./SettingsModal.svelte";
type Props = {
@@ -75,9 +72,18 @@
: file.converters
: files.files.flatMap((f) => f.converters);
- // pick the best matching category, or fall back to first category
- // TODO: if something fails for some reason, maybe show all categories?
- const detectedCategory =
+ // if file is provided, first try to find its category by input format
+ let detectedCategory: string | null = null;
+ if (file && from) {
+ detectedCategory =
+ Object.keys(categories).find((cat) =>
+ categories[cat].formats.includes(from),
+ ) || null;
+ }
+
+ // fallback to category with most converter overlap if input category not found
+ detectedCategory =
+ detectedCategory ||
pickCategoryFromConverters(convertersToCheck) ||
Object.keys(categories)[0];
diff --git a/src/lib/converters/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg.svelte.ts
index 21289e5..fb8fdaa 100644
--- a/src/lib/converters/ffmpeg.svelte.ts
+++ b/src/lib/converters/ffmpeg.svelte.ts
@@ -164,6 +164,7 @@ export class FFmpegConverter extends Converter {
default: audioTracks ?? 1,
min: 1,
max: audioTracks ? audioTracks : 1,
+ placeholder: audioTracks ?? 1
};
const audioChannels = await this.detectAudioChannels(ffmpeg);
@@ -174,6 +175,7 @@ export class FFmpegConverter extends Converter {
default: audioChannels ?? 2,
min: 1,
max: audioChannels ? audioChannels * 2 : 5,
+ placeholder: audioChannels ?? 2
};
const metadata: SettingDefinition = {