mirror of https://github.com/VERT-sh/VERT.git
fix: open native category first
This commit is contained in:
parent
4fca8a9696
commit
f129682474
|
|
@ -8,9 +8,6 @@
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { quintOut } from "svelte/easing";
|
import { quintOut } from "svelte/easing";
|
||||||
import { VertFile } from "$lib/types";
|
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";
|
import SettingsModal from "./SettingsModal.svelte";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
@ -75,9 +72,18 @@
|
||||||
: file.converters
|
: file.converters
|
||||||
: files.files.flatMap((f) => f.converters);
|
: files.files.flatMap((f) => f.converters);
|
||||||
|
|
||||||
// pick the best matching category, or fall back to first category
|
// if file is provided, first try to find its category by input format
|
||||||
// TODO: if something fails for some reason, maybe show all categories?
|
let detectedCategory: string | null = null;
|
||||||
const detectedCategory =
|
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) ||
|
pickCategoryFromConverters(convertersToCheck) ||
|
||||||
Object.keys(categories)[0];
|
Object.keys(categories)[0];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ export class FFmpegConverter extends Converter {
|
||||||
default: audioTracks ?? 1,
|
default: audioTracks ?? 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
max: audioTracks ? audioTracks : 1,
|
max: audioTracks ? audioTracks : 1,
|
||||||
|
placeholder: audioTracks ?? 1
|
||||||
};
|
};
|
||||||
|
|
||||||
const audioChannels = await this.detectAudioChannels(ffmpeg);
|
const audioChannels = await this.detectAudioChannels(ffmpeg);
|
||||||
|
|
@ -174,6 +175,7 @@ export class FFmpegConverter extends Converter {
|
||||||
default: audioChannels ?? 2,
|
default: audioChannels ?? 2,
|
||||||
min: 1,
|
min: 1,
|
||||||
max: audioChannels ? audioChannels * 2 : 5,
|
max: audioChannels ? audioChannels * 2 : 5,
|
||||||
|
placeholder: audioChannels ?? 2
|
||||||
};
|
};
|
||||||
|
|
||||||
const metadata: SettingDefinition = {
|
const metadata: SettingDefinition = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue