mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-10 04:19:25 -07:00
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import type { RegisterIpcRuntimeServicesParams } from '../ipc-runtime';
|
|
import {
|
|
appendPlaylistBrowserFileRuntime,
|
|
getPlaylistBrowserSnapshotRuntime,
|
|
movePlaylistBrowserIndexRuntime,
|
|
playPlaylistBrowserIndexRuntime,
|
|
removePlaylistBrowserIndexRuntime,
|
|
type PlaylistBrowserRuntimeDeps,
|
|
} from './playlist-browser-runtime';
|
|
|
|
type PlaylistBrowserMainDeps = Pick<
|
|
RegisterIpcRuntimeServicesParams['mainDeps'],
|
|
| 'getPlaylistBrowserSnapshot'
|
|
| 'appendPlaylistBrowserFile'
|
|
| 'playPlaylistBrowserIndex'
|
|
| 'removePlaylistBrowserIndex'
|
|
| 'movePlaylistBrowserIndex'
|
|
>;
|
|
|
|
export type PlaylistBrowserIpcRuntime = {
|
|
playlistBrowserRuntimeDeps: PlaylistBrowserRuntimeDeps;
|
|
playlistBrowserMainDeps: PlaylistBrowserMainDeps;
|
|
};
|
|
|
|
export function createPlaylistBrowserIpcRuntime(
|
|
getMpvClient: PlaylistBrowserRuntimeDeps['getMpvClient'],
|
|
options?: Pick<
|
|
PlaylistBrowserRuntimeDeps,
|
|
'getPrimarySubtitleLanguages' | 'getSecondarySubtitleLanguages'
|
|
>,
|
|
): PlaylistBrowserIpcRuntime {
|
|
const playlistBrowserRuntimeDeps: PlaylistBrowserRuntimeDeps = {
|
|
getMpvClient,
|
|
getPrimarySubtitleLanguages: options?.getPrimarySubtitleLanguages,
|
|
getSecondarySubtitleLanguages: options?.getSecondarySubtitleLanguages,
|
|
};
|
|
|
|
return {
|
|
playlistBrowserRuntimeDeps,
|
|
playlistBrowserMainDeps: {
|
|
getPlaylistBrowserSnapshot: () =>
|
|
getPlaylistBrowserSnapshotRuntime(playlistBrowserRuntimeDeps),
|
|
appendPlaylistBrowserFile: (filePath: string) =>
|
|
appendPlaylistBrowserFileRuntime(playlistBrowserRuntimeDeps, filePath),
|
|
playPlaylistBrowserIndex: (index: number) =>
|
|
playPlaylistBrowserIndexRuntime(playlistBrowserRuntimeDeps, index),
|
|
removePlaylistBrowserIndex: (index: number) =>
|
|
removePlaylistBrowserIndexRuntime(playlistBrowserRuntimeDeps, index),
|
|
movePlaylistBrowserIndex: (index: number, direction: 1 | -1) =>
|
|
movePlaylistBrowserIndexRuntime(playlistBrowserRuntimeDeps, index, direction),
|
|
},
|
|
};
|
|
}
|