From f129682474731896d8b0725cedb35629c47783b3 Mon Sep 17 00:00:00 2001 From: Maya Date: Wed, 18 Feb 2026 09:35:30 +0300 Subject: [PATCH] fix: open native category first --- .../functional/FormatDropdown.svelte | 18 ++++++++++++------ src/lib/converters/ffmpeg.svelte.ts | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) 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 = {