B: add download of season media + maintenance

This commit is contained in:
X4Lo committed 2025-02-20 01:34:42 +01:00
1 parent d799ef2368
commit 534572775f
6 files changed
+76 -16

No files matched your search

+7 -1
View File
@@ -164,7 +164,10 @@ class EntryManager {
let existingSeason = await Season.findOne({
where: {
tmdb_id: season.id
}
},
include: [
{ model: Media, as: 'medias' }
]
});
// If the season exists, update it; otherwise, create a new season
@@ -198,6 +201,9 @@ class EntryManager {
});
}
if (existingSeason.medias.length = 0)
_mediaManager.getSeasonMedia(existingSeason);
// * Update or insert episodes for the season
for (const episode of seasonData.episodes) {
// Fetch existing episode data if it exists