Update:Load playlists only when needed & remove podcast episode from playlist when deleted

This commit is contained in:
advplyr 2023-07-23 09:42:57 -05:00
parent 5a9eed0a5a
commit 710a62c2af
7 changed files with 178 additions and 23 deletions

View file

@ -19,7 +19,6 @@ class Database {
// TODO: below data should be loaded from the DB as needed
this.libraryItems = []
this.settings = []
this.playlists = []
this.authors = []
this.series = []
@ -160,9 +159,6 @@ class Database {
this.libraryItems = await this.models.libraryItem.loadAllLibraryItems()
Logger.info(`[Database] Loaded ${this.libraryItems.length} library items`)
this.playlists = await this.models.playlist.getOldPlaylists()
Logger.info(`[Database] Loaded ${this.playlists.length} playlists`)
this.authors = await this.models.author.getOldAuthors()
Logger.info(`[Database] Loaded ${this.authors.length} authors`)
@ -341,7 +337,6 @@ class Database {
await this.createBulkPlaylistMediaItems(playlistMediaItems)
}
}
this.playlists.push(oldPlaylist)
}
updatePlaylist(oldPlaylist) {
@ -364,7 +359,6 @@ class Database {
async removePlaylist(playlistId) {
if (!this.sequelize) return false
await this.models.playlist.removeById(playlistId)
this.playlists = this.playlists.filter(p => p.id !== playlistId)
}
createPlaylistMediaItem(playlistMediaItem) {