Files
SubMiner/src/main/runtime/jellyfin-subtitle-preload-main-deps.ts
T

24 lines
1.0 KiB
TypeScript

import type { createPreloadJellyfinExternalSubtitlesHandler } from './jellyfin-subtitle-preload';
type PreloadJellyfinExternalSubtitlesMainDeps = Parameters<
typeof createPreloadJellyfinExternalSubtitlesHandler
>[0];
export function createBuildPreloadJellyfinExternalSubtitlesMainDepsHandler(
deps: PreloadJellyfinExternalSubtitlesMainDeps,
) {
return (): PreloadJellyfinExternalSubtitlesMainDeps => ({
listJellyfinSubtitleTracks: (session, clientInfo, itemId) =>
deps.listJellyfinSubtitleTracks(session, clientInfo, itemId),
getMpvClient: () => deps.getMpvClient(),
sendMpvCommand: (command) => deps.sendMpvCommand(command),
wait: (ms: number) => deps.wait(ms),
cacheSubtitleTrack: (track) => deps.cacheSubtitleTrack(track),
cleanupCachedSubtitles: (dirs) => deps.cleanupCachedSubtitles(dirs),
initSubtitlePrefetch: deps.initSubtitlePrefetch
? (sourcePath) => deps.initSubtitlePrefetch!(sourcePath)
: undefined,
logDebug: (message: string, error: unknown) => deps.logDebug(message, error),
});
}