Backend:
- add download of episode media function - serving of episodes/seasons files - pulling seasons/episodes media on entry create - maintenance for seasons/episodes media
This commit is contained in:
1 parent
534572775f
commit
4e20c5320b
6 files changed
+58
-31
No files matched your search
@@ -210,7 +210,10 @@ class EntryManager {
|
||||
let existingEpisode = await Episode.findOne({
|
||||
where: {
|
||||
tmdb_id: episode.id,
|
||||
}
|
||||
},
|
||||
include: [
|
||||
{ model: Media, as: 'medias' }
|
||||
]
|
||||
});
|
||||
|
||||
// If the episode exists, update it; otherwise, create a new episode
|
||||
@@ -229,7 +232,7 @@ class EntryManager {
|
||||
await existingEpisode.save();
|
||||
} else {
|
||||
// Create a new episode
|
||||
await Episode.create({
|
||||
existingEpisode = await Episode.create({
|
||||
tmdb_id: episode.id,
|
||||
season_id: existingSeason.id,
|
||||
name: episode.name,
|
||||
@@ -242,6 +245,9 @@ class EntryManager {
|
||||
still_path: episode.still_path,
|
||||
});
|
||||
}
|
||||
|
||||
if (existingEpisode.medias.length == 0)
|
||||
_mediaManager.getEpisodenMedia(existingEpisode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user