mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-31 19:21:33 -07:00
e64ff1a0ee
- Add `subminer anime` / `--anime` and a tray entry to open a browser that searches installed Aniyomi extension sources, shows cover art and episodes, and plays into mpv with overlay/mining attached - Add an Extensions tab to add repos and install/update/remove sources, and per-source settings for sources needing config - Support searching all sources at once with streaming, per-source results and status - Prefer Japanese audio/subtitle tracks from the source and keep the primary subtitle slot reserved for Japanese - Fix window/tray/Dock handling so the browser and mpv can be switched between without quitting the app or losing the Dock icon - Add anime.repos, anime.extensionsDir, anime.preferredQuality config keys (no bundled repos or discovery)
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import {
|
|
launchAppCommandDetached,
|
|
launchAppBackgroundDetached,
|
|
launchTexthookerOnly,
|
|
runAppCommandWithInherit,
|
|
} from '../mpv.js';
|
|
import type { LauncherCommandContext } from './context.js';
|
|
|
|
type AppCommandDeps = {
|
|
runAppCommandWithInherit: (appPath: string, appArgs: string[]) => void;
|
|
launchSyncUiDetached: (
|
|
appPath: string,
|
|
logLevel: LauncherCommandContext['args']['logLevel'],
|
|
) => void;
|
|
launchAppBackgroundDetached: (
|
|
appPath: string,
|
|
logLevel: LauncherCommandContext['args']['logLevel'],
|
|
) => void;
|
|
launchAnimeBrowserDetached: (
|
|
appPath: string,
|
|
logLevel: LauncherCommandContext['args']['logLevel'],
|
|
) => void;
|
|
};
|
|
|
|
const defaultAppCommandDeps: AppCommandDeps = {
|
|
runAppCommandWithInherit,
|
|
launchSyncUiDetached: (appPath, logLevel) =>
|
|
launchAppCommandDetached(appPath, ['--sync-window'], logLevel, 'sync-ui'),
|
|
launchAppBackgroundDetached,
|
|
launchAnimeBrowserDetached: (appPath, logLevel) =>
|
|
launchAppCommandDetached(appPath, ['--anime'], logLevel, 'anime'),
|
|
};
|
|
|
|
export function runAppPassthroughCommand(
|
|
context: LauncherCommandContext,
|
|
deps: AppCommandDeps = defaultAppCommandDeps,
|
|
): boolean {
|
|
const { args, appPath } = context;
|
|
if (!appPath) {
|
|
return false;
|
|
}
|
|
if (args.settings) {
|
|
deps.runAppCommandWithInherit(appPath, ['--settings']);
|
|
return true;
|
|
}
|
|
if (args.animeBrowser) {
|
|
// Detached: the browser window is long-lived and owns the bridge process.
|
|
deps.launchAnimeBrowserDetached(appPath, args.logLevel);
|
|
return true;
|
|
}
|
|
if (args.syncUi) {
|
|
deps.launchSyncUiDetached(appPath, args.logLevel);
|
|
return true;
|
|
}
|
|
if (!args.appPassthrough) {
|
|
return false;
|
|
}
|
|
if (args.appArgs.length === 0) {
|
|
deps.launchAppBackgroundDetached(appPath, args.logLevel);
|
|
return true;
|
|
}
|
|
deps.runAppCommandWithInherit(appPath, args.appArgs);
|
|
return true;
|
|
}
|
|
|
|
export function runTexthookerCommand(context: LauncherCommandContext): boolean {
|
|
const { args, appPath } = context;
|
|
if (!args.texthookerOnly || !appPath) {
|
|
return false;
|
|
}
|
|
launchTexthookerOnly(appPath, args);
|
|
return true;
|
|
}
|