mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-21 12:11:28 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
45
src/main/runtime/jellyfin-remote-connection-main-deps.ts
Normal file
45
src/main/runtime/jellyfin-remote-connection-main-deps.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import type {
|
||||
EnsureMpvConnectedDeps,
|
||||
LaunchMpvForJellyfinDeps,
|
||||
WaitForMpvConnectedDeps,
|
||||
} from './jellyfin-remote-connection';
|
||||
|
||||
export function createBuildWaitForMpvConnectedMainDepsHandler(deps: WaitForMpvConnectedDeps) {
|
||||
return (): WaitForMpvConnectedDeps => ({
|
||||
getMpvClient: () => deps.getMpvClient(),
|
||||
now: () => deps.now(),
|
||||
sleep: (delayMs: number) => deps.sleep(delayMs),
|
||||
});
|
||||
}
|
||||
|
||||
export function createBuildLaunchMpvIdleForJellyfinPlaybackMainDepsHandler(
|
||||
deps: LaunchMpvForJellyfinDeps,
|
||||
) {
|
||||
return (): LaunchMpvForJellyfinDeps => ({
|
||||
getSocketPath: () => deps.getSocketPath(),
|
||||
platform: deps.platform,
|
||||
execPath: deps.execPath,
|
||||
defaultMpvLogPath: deps.defaultMpvLogPath,
|
||||
defaultMpvArgs: deps.defaultMpvArgs,
|
||||
removeSocketPath: (socketPath: string) => deps.removeSocketPath(socketPath),
|
||||
spawnMpv: (args: string[]) => deps.spawnMpv(args),
|
||||
logWarn: (message: string, error: unknown) => deps.logWarn(message, error),
|
||||
logInfo: (message: string) => deps.logInfo(message),
|
||||
});
|
||||
}
|
||||
|
||||
export function createBuildEnsureMpvConnectedForJellyfinPlaybackMainDepsHandler(
|
||||
deps: EnsureMpvConnectedDeps,
|
||||
) {
|
||||
return (): EnsureMpvConnectedDeps => ({
|
||||
getMpvClient: () => deps.getMpvClient(),
|
||||
setMpvClient: (client) => deps.setMpvClient(client),
|
||||
createMpvClient: () => deps.createMpvClient(),
|
||||
waitForMpvConnected: (timeoutMs: number) => deps.waitForMpvConnected(timeoutMs),
|
||||
launchMpvIdleForJellyfinPlayback: () => deps.launchMpvIdleForJellyfinPlayback(),
|
||||
getAutoLaunchInFlight: () => deps.getAutoLaunchInFlight(),
|
||||
setAutoLaunchInFlight: (promise) => deps.setAutoLaunchInFlight(promise),
|
||||
connectTimeoutMs: deps.connectTimeoutMs,
|
||||
autoLaunchTimeoutMs: deps.autoLaunchTimeoutMs,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user