fix(jellyfin): make terminal play work with a running app and report progress (#288)

This commit is contained in:
sudacode authored and GitHub committed 2026-10-10 17:27:48 -07:00
1 parent 78eca52b7e
commit 78a9b6346f
33 files changed
+934 -924

No files matched your search

+22
View File
@@ -1121,6 +1121,21 @@ function clearOverlayManagedByLauncher(): void {
state.overlayManagedByLauncher = false;
}
// For commands that start the app ahead of playback (the Jellyfin picker): the launcher now owns
// it, as with local playback, and stops it when the launcher exits for any reason, including a
// cancelled picker or Ctrl+C.
export function adoptLauncherStartedApp(appPath: string, args: Args): void {
if (state.overlayManagedByLauncher) return;
markOverlayManagedByLauncher(appPath);
process.once('exit', () => stopManagedOverlayApp(args));
process.once('SIGINT', () => process.exit(130));
process.once('SIGTERM', () => process.exit(143));
}
export function isAppManagedByLauncher(): boolean {
return state.overlayManagedByLauncher;
}
function isAppAlreadyRunning(appPath: string, logLevel: LogLevel): boolean {
const result = runSyncAppCommand(appPath, ['--app-ping'], false);
if (result.error) {
@@ -1723,6 +1738,13 @@ export async function canConnectUnixSocket(socketPath: string): Promise<boolean>
});
}
// Resolves once mpv stops accepting connections on its IPC socket, i.e. the player was closed.
export async function waitForUnixSocketClosed(socketPath: string, pollMs = 1000): Promise<void> {
while (await canConnectUnixSocket(socketPath)) {
await sleep(pollMs);
}
}
export async function waitForUnixSocketReady(
socketPath: string,
timeoutMs: number,