Files
SubMiner/src/core/services/runtime-options-ipc.ts
T
sudacode 7909fcd2cf refactor(ipc): remove dead preload methods and the ASS line broadcast (#293)
Drop 16 overlay preload methods with no caller (onSubtitleAss,
getCurrentSubtitleAss, onVisibility, getOverlayVisibility,
openYomitanSettings, quitApp, toggleOverlay, getMecabStatus,
setMecabEnabled, getKeybindings, saveControllerPreference,
getAnkiConnectStatus, setAnkiConnectEnabled, clearAnkiConnectHistory,
cycleRuntimeOption, appendClipboardVideoToQueue) along with their
IPC_CHANNELS keys, handlers, validators and dep plumbing.

With both ASS consumers gone, stop observing sub-text/ass in mpv and
remove the subtitle-ass-change event chain and appState.currentSubAssText.
The main-process functions these wrapped stay; tray, CLI, shortcuts and
session actions still use them.
2026-10-12 22:11:17 -07:00

37 lines
1.1 KiB
TypeScript

import {
RuntimeOptionApplyResult,
RuntimeOptionId,
RuntimeOptionValue,
} from '../../types/runtime-options';
export interface RuntimeOptionsManagerLike {
setOptionValue: (id: RuntimeOptionId, value: RuntimeOptionValue) => RuntimeOptionApplyResult;
cycleOption: (id: RuntimeOptionId, direction: 1 | -1) => RuntimeOptionApplyResult;
}
export function applyRuntimeOptionResultRuntime(
result: RuntimeOptionApplyResult,
showMpvOsd: (text: string) => void,
): RuntimeOptionApplyResult {
if (result.ok && result.osdMessage) {
showMpvOsd(result.osdMessage);
}
return result;
}
export function setRuntimeOptionFromIpcRuntime(
manager: RuntimeOptionsManagerLike | null,
id: RuntimeOptionId,
value: RuntimeOptionValue,
showMpvOsd: (text: string) => void,
): RuntimeOptionApplyResult {
if (!manager) {
return { ok: false, error: 'Runtime options manager unavailable' };
}
const result = applyRuntimeOptionResultRuntime(manager.setOptionValue(id, value), showMpvOsd);
if (!result.ok && result.error) {
showMpvOsd(result.error);
}
return result;
}