First working POC

This commit is contained in:
2026-01-26 22:21:54 +01:00
commit cfddc1edea
255 changed files with 77606 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
/**
* Next Episode Service
*
* Handles user interactions with the next episode popup.
* Backend manages countdown logic and autoplay decisions.
*/
import { cancelAutoplayCountdown, playNextEpisode } from "$lib/api/autoplay";
import { nextEpisode } from "$lib/stores/nextEpisode";
/**
* Cleanup next episode state (called on unmount/destroy)
*/
export function cleanup() {
nextEpisode.reset();
}
/**
* Handle episode ended event
* Backend now handles autoplay decisions via on_playback_ended()
* This function is kept for backwards compatibility but does nothing
*/
export async function handleEpisodeEnded(media: any) {
// Backend now handles this - no action needed
// The backend will emit ShowNextEpisodePopup event
}
/**
* Cancel the autoplay countdown
* Called when user clicks "Cancel" button on next episode popup
*/
export async function cancelAutoPlay() {
await cancelAutoplayCountdown();
nextEpisode.hidePopup();
}
/**
* Manually play the next episode
* Called when user clicks "Play Now" button on next episode popup
*
* @param nextEpisodeItem - The next episode to play
*/
export async function watchNextManually(nextEpisodeItem: any) {
await playNextEpisode(nextEpisodeItem);
nextEpisode.hidePopup();
}