mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
Introduce MPV process reuse and IPC control, and add basic EPG IPC
handlers.
- Add GET_CHANNEL_PROGRAMS and FETCH_EPG ipc handlers to epg.events.ts
to expose fetching EPG data by channel or URLs.
- Rework player.events.ts:
- Export proper bootstrap and add module-level mpvProcess and
mpvSocketPath to track a reusable MPV instance.
- Add sendMpvCommand helper to communicate with MPV via its IPC socket.
- Implement OPEN_MPV_PLAYER handler that:
- Reads MPV path and MPV_REUSE_INSTANCE setting from store.
- Attempts to reuse an existing MPV process by sending loadfile
command over the socket when reuse is enabled.
- Falls back to spawning a new mpv process, creating a unique IPC
socket path, and storing the process/socket when reuse is enabled.
- Adds error and exit handlers to clear stored references.
- Add necessary imports (ChildProcess, existsSync, createConnection).
- Remove/comment unused import block for shared-interfaces and adapt
existing code to the new flow.
Why:
- Enable reusing a single MPV instance to improve resource usage and
provide faster playback switching.
- Add IPC endpoints for EPG to support frontend requests for program
data.
58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
import 'jest-extended';
|
|
import { Playlist } from './libs/shared/interfaces/src/lib/playlist.interface';
|
|
|
|
declare module 'video.js' {
|
|
export interface VideoJsPlayer {
|
|
hlsQualitySelector(options?: Record<string, unknown>): void;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
electron: {
|
|
getAppVersion: () => Promise<string>;
|
|
platform: string;
|
|
fetchPlaylistByUrl: (
|
|
url: string,
|
|
title?: string
|
|
) => Promise<Playlist>;
|
|
updatePlaylistFromFilePath: (
|
|
filePath: string,
|
|
title: string
|
|
) => Promise<Playlist>;
|
|
openPlaylistFromFile: () => Promise<Playlist>;
|
|
setUserAgent: (userAgent: string, referer?: string) => void;
|
|
openInMpv: (
|
|
url: string,
|
|
path: string,
|
|
title: string,
|
|
userAgent: string,
|
|
referer?: string,
|
|
origin?: string
|
|
) => void;
|
|
openInVlc: (
|
|
url: string,
|
|
path: string,
|
|
title: string,
|
|
userAgent: string,
|
|
referer?: string,
|
|
origin?: string
|
|
) => void;
|
|
autoUpdatePlaylists: (playlists: Playlist[]) => Promise<Playlist[]>;
|
|
fetchEpg: (urls: string[]) => Promise<any>;
|
|
getChannelPrograms: (channelId: string) => Promise<any>;
|
|
updateSettings: (settings: any) => Promise<void>;
|
|
setMpvPlayerPath: (mpvPlayerPath: string) => Promise<void>;
|
|
setVlcPlayerPath: (vlcPlayerPath: string) => Promise<void>;
|
|
};
|
|
process: NodeJS.Process;
|
|
require: NodeRequire;
|
|
}
|
|
}
|
|
|
|
// SystemJS module definition
|
|
declare const nodeModule: NodeModule;
|
|
interface NodeModule {
|
|
id: string;
|
|
}
|