feat(launcher): add mpv.profile config option for managed launches (#80)

This commit is contained in:
2026-05-23 15:14:19 -07:00
committed by GitHub
parent c4f99fec2f
commit 7e86c4ea3d
20 changed files with 110 additions and 4 deletions
+14
View File
@@ -45,6 +45,20 @@ test('createDefaultArgs normalizes configured language codes and env thread over
}
});
test('createDefaultArgs seeds mpv profile from launcher config', () => {
const parsed = createDefaultArgs({}, { profile: 'anime' });
assert.equal(parsed.profile, 'anime');
});
test('applyRootOptionsToArgs appends CLI mpv profile to configured profile', () => {
const parsed = createDefaultArgs({}, { profile: 'anime' });
applyRootOptionsToArgs(parsed, { profile: 'hdr' }, undefined);
assert.equal(parsed.profile, 'anime,hdr');
});
test('applyRootOptionsToArgs maps file, directory, and url targets', () => {
withTempDir((dir) => {
const filePath = path.join(dir, 'movie.mkv');
+9 -2
View File
@@ -68,6 +68,12 @@ function parseBackend(value: string): Backend {
fail(`Invalid backend: ${value} (must be auto, hyprland, sway, x11, macos, or windows)`);
}
function appendMpvProfile(current: string, next: string): string {
const trimmed = next.trim();
if (!trimmed) return current;
return current ? `${current},${trimmed}` : trimmed;
}
function parseDictionaryTarget(value: string): string {
const trimmed = value.trim();
if (!trimmed) {
@@ -121,7 +127,7 @@ export function createDefaultArgs(
backend: mpvConfig.backend ?? 'auto',
directory: '.',
recursive: false,
profile: '',
profile: mpvConfig.profile ?? '',
startOverlay: false,
whisperBin: process.env.SUBMINER_WHISPER_BIN || launcherConfig.whisperBin || '',
whisperModel: process.env.SUBMINER_WHISPER_MODEL || launcherConfig.whisperModel || '',
@@ -215,7 +221,8 @@ export function applyRootOptionsToArgs(
if (typeof options.backend === 'string') parsed.backend = parseBackend(options.backend);
if (typeof options.directory === 'string') parsed.directory = options.directory;
if (options.recursive === true) parsed.recursive = true;
if (typeof options.profile === 'string') parsed.profile = options.profile;
if (typeof options.profile === 'string')
parsed.profile = appendMpvProfile(parsed.profile, options.profile);
if (options.start === true) parsed.startOverlay = true;
if (typeof options.logLevel === 'string') parsed.logLevel = parseLogLevel(options.logLevel);
if (typeof options.passwordStore === 'string') parsed.passwordStore = options.passwordStore;
+1
View File
@@ -31,6 +31,7 @@ export function parseLauncherMpvConfig(root: Record<string, unknown>): LauncherM
return {
launchMode: parseMpvLaunchMode(mpv.launchMode),
profile: parseNonEmptyString(mpv.profile),
socketPath: parseNonEmptyString(mpv.socketPath),
backend: parseBackend(mpv.backend),
autoStartSubMiner: