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
+6
View File
@@ -150,6 +150,7 @@ test('loads defaults when config is missing', () => {
assert.equal(config.updates.channel, 'stable');
assert.equal(config.mpv.socketPath, '/tmp/subminer-socket');
assert.equal(config.mpv.backend, 'auto');
assert.equal(config.mpv.profile, '');
assert.equal(config.mpv.autoStartSubMiner, true);
assert.equal(config.mpv.pauseUntilOverlayReady, true);
assert.equal(config.mpv.subminerBinaryPath, '');
@@ -357,6 +358,7 @@ test('parses managed mpv plugin runtime settings from config', () => {
"mpv": {
"socketPath": "/tmp/custom-subminer.sock",
"backend": "x11",
"profile": " anime ",
"autoStartSubMiner": false,
"pauseUntilOverlayReady": false,
"subminerBinaryPath": "/opt/SubMiner/SubMiner.AppImage",
@@ -371,6 +373,7 @@ test('parses managed mpv plugin runtime settings from config', () => {
const config = validService.getConfig();
assert.equal(config.mpv.socketPath, '/tmp/custom-subminer.sock');
assert.equal(config.mpv.backend, 'x11');
assert.equal(config.mpv.profile, 'anime');
assert.equal(config.mpv.autoStartSubMiner, false);
assert.equal(config.mpv.pauseUntilOverlayReady, false);
assert.equal(config.mpv.subminerBinaryPath, '/opt/SubMiner/SubMiner.AppImage');
@@ -384,6 +387,7 @@ test('parses managed mpv plugin runtime settings from config', () => {
"mpv": {
"socketPath": "",
"backend": "weston",
"profile": 12,
"autoStartSubMiner": "yes",
"pauseUntilOverlayReady": "no",
"subminerBinaryPath": 42,
@@ -399,6 +403,7 @@ test('parses managed mpv plugin runtime settings from config', () => {
const warnings = invalidService.getWarnings();
assert.equal(invalidConfig.mpv.socketPath, DEFAULT_CONFIG.mpv.socketPath);
assert.equal(invalidConfig.mpv.backend, DEFAULT_CONFIG.mpv.backend);
assert.equal(invalidConfig.mpv.profile, DEFAULT_CONFIG.mpv.profile);
assert.equal(invalidConfig.mpv.autoStartSubMiner, DEFAULT_CONFIG.mpv.autoStartSubMiner);
assert.equal(invalidConfig.mpv.pauseUntilOverlayReady, DEFAULT_CONFIG.mpv.pauseUntilOverlayReady);
assert.equal(invalidConfig.mpv.subminerBinaryPath, DEFAULT_CONFIG.mpv.subminerBinaryPath);
@@ -406,6 +411,7 @@ test('parses managed mpv plugin runtime settings from config', () => {
assert.equal(invalidConfig.mpv.aniskipButtonKey, DEFAULT_CONFIG.mpv.aniskipButtonKey);
assert.ok(warnings.some((warning) => warning.path === 'mpv.socketPath'));
assert.ok(warnings.some((warning) => warning.path === 'mpv.backend'));
assert.ok(warnings.some((warning) => warning.path === 'mpv.profile'));
assert.ok(warnings.some((warning) => warning.path === 'mpv.autoStartSubMiner'));
assert.ok(warnings.some((warning) => warning.path === 'mpv.pauseUntilOverlayReady'));
assert.ok(warnings.some((warning) => warning.path === 'mpv.subminerBinaryPath'));
@@ -94,6 +94,7 @@ export const INTEGRATIONS_DEFAULT_CONFIG: Pick<
mpv: {
executablePath: '',
launchMode: 'normal',
profile: '',
socketPath: getDefaultMpvSocketPath(),
backend: 'auto',
autoStartSubMiner: true,
@@ -105,6 +105,7 @@ test('config option registry includes critical paths and has unique entries', ()
'anilist.characterDictionary.collapsibleSections.description',
'mpv.executablePath',
'mpv.launchMode',
'mpv.profile',
'mpv.socketPath',
'mpv.backend',
'mpv.autoStartSubMiner',
@@ -449,6 +449,13 @@ export function buildIntegrationConfigOptionRegistry(
defaultValue: defaultConfig.mpv.launchMode,
description: 'Default window state for SubMiner-managed mpv launches.',
},
{
path: 'mpv.profile',
kind: 'string',
defaultValue: defaultConfig.mpv.profile,
description:
'Optional mpv profile name passed to SubMiner-managed mpv launches. Leave empty to pass no profile.',
},
{
path: 'mpv.socketPath',
kind: 'string',
@@ -175,6 +175,7 @@ const INTEGRATION_TEMPLATE_SECTIONS: ConfigTemplateSection[] = [
'Set mpv.socketPath to the IPC socket used by the launcher, Electron app, and bundled plugin.',
'autoStartSubMiner starts SubMiner in the background; auto_start_overlay only controls visible overlay display.',
'Set mpv.launchMode to choose normal, maximized, or fullscreen SubMiner-managed mpv playback.',
'Set mpv.profile to pass an mpv profile to managed mpv launches; leave it blank to pass none.',
'Leave mpv.executablePath blank to auto-discover mpv.exe from SUBMINER_MPV_PATH or PATH.',
],
key: 'mpv',
+7
View File
@@ -254,6 +254,13 @@ export function applyIntegrationConfig(context: ResolveContext): void {
);
}
const profile = asString(src.mpv.profile);
if (profile !== undefined) {
resolved.mpv.profile = profile.trim();
} else if (src.mpv.profile !== undefined) {
warn('mpv.profile', src.mpv.profile, resolved.mpv.profile, 'Expected string.');
}
const socketPath = asString(src.mpv.socketPath);
if (socketPath !== undefined && socketPath.trim().length > 0) {
resolved.mpv.socketPath = socketPath.trim();
+3
View File
@@ -24,6 +24,8 @@ test('settings registry splits viewing into appearance and behavior categories',
assert.equal(field('youtube.primarySubLanguages').section, 'YouTube Playback Settings');
assert.equal(field('mpv.launchMode').category, 'behavior');
assert.equal(field('mpv.launchMode').section, 'mpv Playback');
assert.equal(field('mpv.profile').category, 'behavior');
assert.equal(field('mpv.profile').section, 'mpv Playback');
assert.ok(
fields.findIndex((candidate) => candidate.configPath === 'subtitleStyle.primaryDefaultMode') <
fields.findIndex((candidate) => candidate.configPath === 'secondarySub.defaultMode'),
@@ -298,6 +300,7 @@ test('settings registry keeps unsafe config siblings restart-required', () => {
'ankiConnect.url',
'ankiConnect.proxy.enabled',
'mpv.socketPath',
'mpv.profile',
'websocket.port',
]) {
assert.equal(field(path).restartBehavior, 'restart', path);
+2
View File
@@ -184,6 +184,7 @@ const PATH_ORDER = new Map<string, number>(
'mpv.backend',
'mpv.subminerBinaryPath',
'mpv.aniskipEnabled',
'mpv.profile',
'mpv.launchMode',
'mpv.executablePath',
'mpv.aniskipButtonKey',
@@ -225,6 +226,7 @@ const LABEL_OVERRIDES: Record<string, string> = {
'mpv.executablePath': 'mpv Executable Path',
'mpv.subminerBinaryPath': 'SubMiner Binary Path',
'mpv.socketPath': 'mpv IPC Socket Path',
'mpv.profile': 'mpv Profile',
'mpv.autoStartSubMiner': 'Auto-start SubMiner',
'mpv.pauseUntilOverlayReady': 'Pause Until Overlay Ready',
'mpv.aniskipEnabled': 'Enable AniSkip',
+2
View File
@@ -58,6 +58,7 @@ export type MpvBackend = 'auto' | 'hyprland' | 'sway' | 'x11' | 'macos' | 'windo
export interface MpvConfig {
executablePath?: string;
launchMode?: MpvLaunchMode;
profile?: string;
socketPath?: string;
backend?: MpvBackend;
autoStartSubMiner?: boolean;
@@ -156,6 +157,7 @@ export interface ResolvedConfig {
mpv: {
executablePath: string;
launchMode: MpvLaunchMode;
profile: string;
socketPath: string;
backend: MpvBackend;
autoStartSubMiner: boolean;