|
|
@ -87,6 +87,11 @@ export function progressResponsesToEntries(responses: ProgressResponse[]) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const item = items[v.tmdbId]; |
|
|
|
const item = items[v.tmdbId]; |
|
|
|
|
|
|
|
// Update the item only if the new update is more recent than the current one
|
|
|
|
|
|
|
|
if (new Date(v.updatedAt).getTime() > item.updatedAt) { |
|
|
|
|
|
|
|
item.updatedAt = new Date(v.updatedAt).getTime(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (item.type === "movie") { |
|
|
|
if (item.type === "movie") { |
|
|
|
item.progress = { |
|
|
|
item.progress = { |
|
|
|
duration: Number(v.duration), |
|
|
|
duration: Number(v.duration), |
|
|
@ -95,22 +100,29 @@ export function progressResponsesToEntries(responses: ProgressResponse[]) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (item.type === "show" && v.season.id && v.episode.id) { |
|
|
|
if (item.type === "show" && v.season.id && v.episode.id) { |
|
|
|
item.seasons[v.season.id] = { |
|
|
|
if ( |
|
|
|
id: v.season.id, |
|
|
|
!item.seasons[v.season.id] || |
|
|
|
number: v.season.number ?? 0, |
|
|
|
(item.episodes[v.episode.id] && |
|
|
|
title: "", |
|
|
|
new Date(v.updatedAt).getTime() > |
|
|
|
}; |
|
|
|
item.episodes[v.episode.id].updatedAt) |
|
|
|
item.episodes[v.episode.id] = { |
|
|
|
) { |
|
|
|
id: v.episode.id, |
|
|
|
item.seasons[v.season.id] = { |
|
|
|
number: v.episode.number ?? 0, |
|
|
|
id: v.season.id, |
|
|
|
title: "", |
|
|
|
number: v.season.number ?? 0, |
|
|
|
progress: { |
|
|
|
title: "", |
|
|
|
duration: Number(v.duration), |
|
|
|
}; |
|
|
|
watched: Number(v.watched), |
|
|
|
item.episodes[v.episode.id] = { |
|
|
|
}, |
|
|
|
id: v.episode.id, |
|
|
|
seasonId: v.season.id, |
|
|
|
number: v.episode.number ?? 0, |
|
|
|
updatedAt: new Date(v.updatedAt).getTime(), |
|
|
|
title: "", |
|
|
|
}; |
|
|
|
progress: { |
|
|
|
|
|
|
|
duration: Number(v.duration), |
|
|
|
|
|
|
|
watched: Number(v.watched), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
seasonId: v.season.id, |
|
|
|
|
|
|
|
updatedAt: new Date(v.updatedAt).getTime(), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|