feat(launcher): add post-playback history menu with previous episode

- After a history episode ends or mpv closes, show a menu to play the previous/next episode, rewatch, browse, or quit, looping back to the same series
- Add findPreviousEpisode to step backward within and across season directories
- Add quit option to the initial history series-action menu
- Dedupe signal-handler registration in playback-command so repeated history sessions don't stack SIGINT/SIGTERM handlers
- Update README and docs-site for the new history flow
This commit is contained in:
2026-07-16 01:43:46 -07:00
parent 2398f5c030
commit 6a92f428a3
11 changed files with 532 additions and 22 deletions
+5 -1
View File
@@ -30,6 +30,7 @@ import { hasLauncherExternalYomitanProfileConfig } from '../config.js';
const SETUP_WAIT_TIMEOUT_MS = 10 * 60 * 1000;
const SETUP_POLL_INTERVAL_MS = 500;
const cleanupRegisteredProcessAdapters = new WeakSet<LauncherCommandContext['processAdapter']>();
function getLauncherConfigDir(): string {
return getDefaultConfigDir({
@@ -92,8 +93,10 @@ async function chooseTarget(
return { target: selected, kind: 'file' };
}
function registerCleanup(context: LauncherCommandContext): void {
export function registerCleanup(context: LauncherCommandContext): void {
const { args, processAdapter } = context;
if (cleanupRegisteredProcessAdapters.has(processAdapter)) return;
processAdapter.onSignal('SIGINT', () => {
stopOverlay(args);
processAdapter.exit(130);
@@ -102,6 +105,7 @@ function registerCleanup(context: LauncherCommandContext): void {
stopOverlay(args);
processAdapter.exit(143);
});
cleanupRegisteredProcessAdapters.add(processAdapter);
}
async function ensurePlaybackSetupReady(context: LauncherCommandContext): Promise<void> {