Update item image in audio player when updated on item #4025

This commit is contained in:
advplyr 2025-04-01 17:32:21 -05:00
parent 96825c3c2b
commit ddf2ca3670
3 changed files with 9 additions and 2 deletions

View File

@ -156,7 +156,7 @@ export default {
return this.mediaMetadata.authors || []
},
libraryId() {
return this.streamLibraryItem ? this.streamLibraryItem.libraryId : null
return this.streamLibraryItem?.libraryId || null
},
totalDurationPretty() {
// Adjusted by playback rate

View File

@ -183,7 +183,7 @@ export default {
this.$store.commit('libraries/updateFilterDataWithItem', libraryItem)
},
libraryItemUpdated(libraryItem) {
if (this.$store.state.selectedLibraryItem && this.$store.state.selectedLibraryItem.id === libraryItem.id) {
if (this.$store.state.selectedLibraryItem?.id === libraryItem.id) {
this.$store.commit('setSelectedLibraryItem', libraryItem)
if (this.$store.state.globals.selectedEpisode && libraryItem.mediaType === 'podcast') {
const episode = libraryItem.media.episodes.find((ep) => ep.id === this.$store.state.globals.selectedEpisode.id)
@ -192,6 +192,9 @@ export default {
}
}
}
if (this.$store.state.streamLibraryItem?.id === libraryItem.id) {
this.$store.commit('updateStreamLibraryItem', libraryItem)
}
this.$eventBus.$emit(`${libraryItem.id}_updated`, libraryItem)
this.$store.commit('libraries/updateFilterDataWithItem', libraryItem)
},

View File

@ -171,6 +171,10 @@ export const mutations = {
state.playerQueueItems = payload.queueItems || []
}
},
updateStreamLibraryItem(state, libraryItem) {
if (!libraryItem) return
state.streamLibraryItem = libraryItem
},
setIsPlaying(state, isPlaying) {
state.streamIsPlaying = isPlaying
},