Update Playlist.js to get only episodes in playlist

This commit is contained in:
drwggm 2024-11-15 14:12:17 -05:00 committed by GitHub
parent 875e6cabe8
commit f71b9b7407
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -77,11 +77,12 @@ class Playlist extends Model {
const oldPlaylist = this.sequelize.models.playlist.getOldPlaylist(this)
const libraryItemIds = oldPlaylist.items.map((i) => i.libraryItemId)
const episodeIds = oldPlaylist.items.map((i) => i.episodeId).filter(id => id !== null)
let libraryItems = await this.sequelize.models.libraryItem.getAllOldLibraryItems({
id: libraryItemIds
id: libraryItemIds,
episodeIds: episodeIds
})
const playlistExpanded = oldPlaylist.toJSONExpanded(libraryItems)
if (include?.includes('rssfeed')) {
@ -94,6 +95,7 @@ class Playlist extends Model {
return playlistExpanded
}
static createFromOld(oldPlaylist) {
const playlist = this.getFromOld(oldPlaylist)
return this.create(playlist)