mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
fix trakt syncing watched shows/movies back to trakt's recent history
This commit is contained in:
parent
2da03d4931
commit
a079649563
1 changed files with 50 additions and 25 deletions
|
|
@ -559,15 +559,23 @@ export function useTraktIntegration() {
|
|||
return undefined;
|
||||
})();
|
||||
|
||||
updatePromises.push(
|
||||
storageService.mergeWithTraktProgress(
|
||||
id,
|
||||
type,
|
||||
item.progress,
|
||||
item.paused_at,
|
||||
episodeId,
|
||||
exactTime
|
||||
)
|
||||
// Merge with local progress
|
||||
await storageService.mergeWithTraktProgress(
|
||||
id,
|
||||
type,
|
||||
item.progress,
|
||||
item.paused_at,
|
||||
episodeId,
|
||||
exactTime
|
||||
);
|
||||
|
||||
// FIX: Mark as already synced so it won't be re-uploaded to Trakt
|
||||
await storageService.updateTraktSyncStatus(
|
||||
id,
|
||||
type,
|
||||
true, // synced = true
|
||||
item.progress,
|
||||
episodeId
|
||||
);
|
||||
} catch (error) {
|
||||
logger.error('[useTraktIntegration] Error preparing Trakt progress update:', error);
|
||||
|
|
@ -581,19 +589,27 @@ export function useTraktIntegration() {
|
|||
const id = movie.movie.ids.imdb;
|
||||
const watchedAt = movie.last_watched_at;
|
||||
|
||||
updatePromises.push(
|
||||
storageService.mergeWithTraktProgress(
|
||||
id,
|
||||
'movie',
|
||||
100, // 100% progress for watched items
|
||||
watchedAt
|
||||
)
|
||||
await storageService.mergeWithTraktProgress(
|
||||
id,
|
||||
'movie',
|
||||
100,
|
||||
watchedAt
|
||||
);
|
||||
|
||||
// FIX: Mark as already synced
|
||||
await storageService.updateTraktSyncStatus(
|
||||
id,
|
||||
'movie',
|
||||
true,
|
||||
100
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('[useTraktIntegration] Error preparing watched movie update:', error);
|
||||
logger.error('[useTraktIntegration] Error preparing watched movie update:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Process watched shows (100% completed episodes)
|
||||
for (const show of watchedShows) {
|
||||
try {
|
||||
if (show.show?.ids?.imdb && show.seasons) {
|
||||
|
|
@ -602,14 +618,22 @@ export function useTraktIntegration() {
|
|||
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
|
||||
)
|
||||
|
||||
await storageService.mergeWithTraktProgress(
|
||||
showImdbId,
|
||||
'series',
|
||||
100,
|
||||
episode.last_watched_at,
|
||||
episodeId
|
||||
);
|
||||
|
||||
// FIX: Mark as already synced
|
||||
await storageService.updateTraktSyncStatus(
|
||||
showImdbId,
|
||||
'series',
|
||||
true,
|
||||
100,
|
||||
episodeId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -618,6 +642,7 @@ export function useTraktIntegration() {
|
|||
logger.error('[useTraktIntegration] Error preparing watched show update:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute all updates in parallel
|
||||
await Promise.all(updatePromises);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue