mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-26 19:12:54 +00:00
fix up next
This commit is contained in:
parent
6cb115ed74
commit
e323906083
1 changed files with 28 additions and 16 deletions
|
|
@ -769,24 +769,36 @@ const ContinueWatchingSection = React.forwardRef<ContinueWatchingRef>((props, re
|
||||||
if (!cachedData?.basicContent) continue;
|
if (!cachedData?.basicContent) continue;
|
||||||
const { metadata, basicContent } = cachedData;
|
const { metadata, basicContent } = cachedData;
|
||||||
|
|
||||||
if (metadata?.videos) {
|
const traktService = TraktService.getInstance();
|
||||||
const nextEpisodeVideo = findNextEpisode(info.season, info.episode, metadata.videos);
|
let showProgress: any = null;
|
||||||
if (nextEpisodeVideo) {
|
|
||||||
logger.log(`➕ [TraktSync] Adding next episode for ${showId}: S${nextEpisodeVideo.season}E${nextEpisodeVideo.episode}`);
|
try {
|
||||||
traktBatch.push({
|
showProgress = await (traktService as any).getShowWatchedProgress?.(showId);
|
||||||
...basicContent,
|
} catch {
|
||||||
id: showId,
|
showProgress = null;
|
||||||
type: 'series',
|
|
||||||
progress: 0, // Next episode, not started
|
|
||||||
lastUpdated: info.watchedAt,
|
|
||||||
season: nextEpisodeVideo.season,
|
|
||||||
episode: nextEpisodeVideo.episode,
|
|
||||||
episodeTitle: `Episode ${nextEpisodeVideo.episode}`,
|
|
||||||
addonId: undefined,
|
|
||||||
} as ContinueWatchingItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!showProgress || showProgress.completed || !showProgress.next_episode) {
|
||||||
|
logger.log(`🚫 [TraktSync] Skipping completed show: ${showId}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextEp = showProgress.next_episode;
|
||||||
|
|
||||||
|
logger.log(`➕ [TraktSync] Adding next episode for ${showId}: S${nextEp.season}E${nextEp.number}`);
|
||||||
|
|
||||||
|
traktBatch.push({
|
||||||
|
...basicContent,
|
||||||
|
id: showId,
|
||||||
|
type: 'series',
|
||||||
|
progress: 0,
|
||||||
|
lastUpdated: info.watchedAt,
|
||||||
|
season: nextEp.season,
|
||||||
|
episode: nextEp.number,
|
||||||
|
episodeTitle: nextEp.title || `Episode ${nextEp.number}`,
|
||||||
|
addonId: undefined,
|
||||||
|
} as ContinueWatchingItem);
|
||||||
|
|
||||||
// Persist "watched" progress for the episode that Trakt reported
|
// Persist "watched" progress for the episode that Trakt reported
|
||||||
if (!recentlyRemovedRef.current.has(showKey)) {
|
if (!recentlyRemovedRef.current.has(showKey)) {
|
||||||
const watchedEpisodeId = `${showId}:${info.season}:${info.episode}`;
|
const watchedEpisodeId = `${showId}:${info.season}:${info.episode}`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue