Add: "Play Next" button for book and podcast cards

This commit is contained in:
Maaz Hassan 2023-12-27 09:41:52 +00:00
parent 0d0bdce337
commit c18f722929
19 changed files with 63 additions and 2 deletions

View file

@ -463,7 +463,11 @@ export default {
if (!this.isQueued) {
items.push({
func: 'addToQueue',
text: this.$strings.ButtonQueueAddItem
text: this.$strings.ButtonQueuePlayNext
},
{
func: 'playNext',
text: this.$strings.ButtonQueuePlayNext
})
} else if (!this.isStreaming) {
items.push({
@ -542,6 +546,10 @@ export default {
items.push({
func: 'addToQueue',
text: this.$strings.ButtonQueueAddItem
},
{
func: 'playNext',
text: this.$strings.ButtonQueuePlayNext
})
} else if (!this.isStreaming) {
items.push({
@ -830,6 +838,33 @@ export default {
}
this.store.commit('addItemToQueue', queueItem)
},
playNext() {
var queueItem = {}
if (this.recentEpisode) {
queueItem = {
libraryItemId: this.libraryItemId,
libraryId: this.libraryId,
episodeId: this.recentEpisode.id,
title: this.recentEpisode.title,
subtitle: this.mediaMetadata.title,
caption: this.recentEpisode.publishedAt ? `Published ${this.$formatDate(this.recentEpisode.publishedAt, this.dateFormat)}` : 'Unknown publish date',
duration: this.recentEpisode.audioFile.duration || null,
coverPath: this.media.coverPath || null
}
} else {
queueItem = {
libraryItemId: this.libraryItemId,
libraryId: this.libraryId,
episodeId: null,
title: this.title,
subtitle: this.author,
caption: '',
duration: this.media.duration || null,
coverPath: this.media.coverPath || null
}
}
this.store.commit('addItemToTopOfQueue', queueItem)
},
removeFromQueue() {
const episodeId = this.recentEpisode ? this.recentEpisode.id : null
this.store.commit('removeItemFromQueue', { libraryItemId: this.libraryItemId, episodeId })