fix for trakt only syncing the latest season disregarding the previous seasons

This commit is contained in:
chrisk325 2026-01-01 01:16:18 +05:30 committed by GitHub
parent fd1107a5a3
commit 9f3831e733
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -521,9 +521,10 @@ export function useTraktIntegration() {
try {
// Fetch both playback progress and recently watched movies
const [traktProgress, watchedMovies] = await Promise.all([
const [traktProgress, watchedMovies, watchedShows] = await Promise.all([
getTraktPlaybackProgress(),
traktService.getWatchedMovies()
traktService.getWatchedShows()
]);
// Progress retrieval logging removed
@ -593,6 +594,28 @@ export function useTraktIntegration() {
logger.error('[useTraktIntegration] Error preparing watched movie update:', error);
}
}
for (const show of watchedShows) {
try {
if (show.show?.ids?.imdb && show.seasons) {
const showImdbId = show.show.ids.imdb;
for (const season of show.seasons) {
for (const episode of season.episodes) {
const episodeId = `${showImdbId}:${season.number}:${episode.number}`;
updatePromises.push(
storageService.mergeWithTraktProgress(
showImdbId,
'series',
100,
episode.last_watched_at,
episodeId
)
);
}
}
}
} catch (error) {
logger.error('[useTraktIntegration] Error preparing watched show update:', error);
// Execute all updates in parallel
await Promise.all(updatePromises);
@ -698,4 +721,4 @@ export function useTraktIntegration() {
isInWatchlist,
isInCollection
};
}
}