mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-10 03:13:32 -07:00
9247248d48
- Add Catppuccin Macchiato overlay notification stack with 3s transient timeout - Add `notifications.overlayPosition` config (top-left | top | top-right) - Route startup tokenization and subtitle annotation status through configured surfaces - Deduplicate rapid subtitle mode toggle notifications - Change `both` to mean overlay + system; add `osd-system` as legacy alias for old behavior - Keep `osd`/`osd-system` as config-file-only legacy values; Settings UI offers overlay/system/both/none
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import type { MpvBackend } from '../types/config';
|
|
import type { LogRotation } from './log-files';
|
|
|
|
export interface SubminerPluginRuntimeScriptOptConfig {
|
|
socketPath: string;
|
|
binaryPath?: string;
|
|
backend: MpvBackend;
|
|
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
logRotation?: LogRotation;
|
|
autoStart: boolean;
|
|
autoStartVisibleOverlay: boolean;
|
|
autoStartPauseUntilReady: boolean;
|
|
osdMessages: boolean;
|
|
texthookerEnabled: boolean;
|
|
aniskipEnabled: boolean;
|
|
aniskipButtonKey: string;
|
|
}
|
|
|
|
function boolScriptOpt(value: boolean): 'yes' | 'no' {
|
|
return value ? 'yes' : 'no';
|
|
}
|
|
|
|
function sanitizeScriptOptValue(value: string): string {
|
|
return value
|
|
.replace(/,/g, ' ')
|
|
.replace(/[\r\n]/g, ' ')
|
|
.replace(/\s+/g, ' ')
|
|
.trim();
|
|
}
|
|
|
|
export function buildSubminerPluginRuntimeScriptOptParts(
|
|
runtimeConfig: SubminerPluginRuntimeScriptOptConfig,
|
|
fallbackAppPath: string,
|
|
): string[] {
|
|
const binaryPath = sanitizeScriptOptValue(runtimeConfig.binaryPath?.trim() || fallbackAppPath);
|
|
const socketPath = sanitizeScriptOptValue(runtimeConfig.socketPath);
|
|
const backend = sanitizeScriptOptValue(runtimeConfig.backend);
|
|
const aniskipButtonKey = sanitizeScriptOptValue(runtimeConfig.aniskipButtonKey);
|
|
return [
|
|
`subminer-binary_path=${binaryPath}`,
|
|
`subminer-socket_path=${socketPath}`,
|
|
`subminer-backend=${backend}`,
|
|
`subminer-auto_start=${boolScriptOpt(runtimeConfig.autoStart)}`,
|
|
`subminer-auto_start_visible_overlay=${boolScriptOpt(runtimeConfig.autoStartVisibleOverlay)}`,
|
|
`subminer-auto_start_pause_until_ready=${boolScriptOpt(
|
|
runtimeConfig.autoStartPauseUntilReady,
|
|
)}`,
|
|
`subminer-osd_messages=${boolScriptOpt(runtimeConfig.osdMessages)}`,
|
|
`subminer-texthooker_enabled=${boolScriptOpt(runtimeConfig.texthookerEnabled)}`,
|
|
`subminer-aniskip_enabled=${boolScriptOpt(runtimeConfig.aniskipEnabled)}`,
|
|
`subminer-aniskip_button_key=${aniskipButtonKey}`,
|
|
];
|
|
}
|