mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 15:32:01 +00:00
minor fix
This commit is contained in:
parent
62e135667b
commit
52647f8abe
1 changed files with 14 additions and 8 deletions
|
|
@ -171,10 +171,15 @@ export const useWatchProgress = (
|
||||||
await traktAutosyncRef.current.handleProgressUpdate(currentTimeRef.current, durationRef.current);
|
await traktAutosyncRef.current.handleProgressUpdate(currentTimeRef.current, durationRef.current);
|
||||||
|
|
||||||
// Requirement 1: Auto Episode Tracking (>= 90% completion)
|
// Requirement 1: Auto Episode Tracking (>= 90% completion)
|
||||||
|
// Only fires once per session via hasScrobbledRef.
|
||||||
|
// watchedService.markEpisodeAsWatched also syncs to Trakt via /sync/history.
|
||||||
|
// If the scrobble path already created the history entry (isSessionComplete=true),
|
||||||
|
// pass skipTrakt=true so we still sync MAL/Simkl but avoid a duplicate Trakt entry.
|
||||||
const progressPercent = (currentTimeRef.current / durationRef.current) * 100;
|
const progressPercent = (currentTimeRef.current / durationRef.current) * 100;
|
||||||
if (progressPercent >= 90 && !hasScrobbledRef.current) {
|
if (progressPercent >= 90 && !hasScrobbledRef.current) {
|
||||||
hasScrobbledRef.current = true;
|
hasScrobbledRef.current = true;
|
||||||
logger.log(`[useWatchProgress] 90% threshold reached, scrobbling to MAL...`);
|
const skipTrakt = traktAutosyncRef.current.isSessionComplete?.() ?? false;
|
||||||
|
logger.log(`[useWatchProgress] 90% threshold reached, syncing (skipTrakt=${skipTrakt})`);
|
||||||
|
|
||||||
const currentImdbId = imdbIdRef.current;
|
const currentImdbId = imdbIdRef.current;
|
||||||
const currentSeason = seasonRef.current;
|
const currentSeason = seasonRef.current;
|
||||||
|
|
@ -187,19 +192,20 @@ export const useWatchProgress = (
|
||||||
|
|
||||||
if (type === 'series' && currentImdbId && currentSeason !== undefined && currentEpisode !== undefined) {
|
if (type === 'series' && currentImdbId && currentSeason !== undefined && currentEpisode !== undefined) {
|
||||||
watchedService.markEpisodeAsWatched(
|
watchedService.markEpisodeAsWatched(
|
||||||
currentImdbId,
|
currentImdbId,
|
||||||
id,
|
id,
|
||||||
currentSeason,
|
currentSeason,
|
||||||
currentEpisode,
|
currentEpisode,
|
||||||
new Date(),
|
new Date(),
|
||||||
currentReleaseDate,
|
currentReleaseDate,
|
||||||
undefined,
|
undefined,
|
||||||
currentMalId,
|
currentMalId,
|
||||||
currentDayIndex,
|
currentDayIndex,
|
||||||
currentTmdbId
|
currentTmdbId,
|
||||||
|
skipTrakt
|
||||||
);
|
);
|
||||||
} else if (type === 'movie' && currentImdbId) {
|
} else if (type === 'movie' && currentImdbId) {
|
||||||
watchedService.markMovieAsWatched(currentImdbId, new Date(), currentMalId, currentTmdbId, currentTitle);
|
watchedService.markMovieAsWatched(currentImdbId, new Date(), currentMalId, currentTmdbId, currentTitle, skipTrakt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue