mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 10:14:36 +02:00
Merge branch 'advplyr:master' into tailwind-4-migration
This commit is contained in:
commit
ca7852171b
44 changed files with 1890 additions and 302 deletions
|
@ -180,6 +180,15 @@ export default {
|
|||
action: 'rescan'
|
||||
})
|
||||
|
||||
// The limit of 50 is introduced because of the URL length. Each id has 36 chars, so 36 * 40 = 1440
|
||||
// + 40 , separators = 1480 chars + base path 280 chars = 1760 chars. This keeps the URL under 2000 chars even with longer domains
|
||||
if (this.selectedMediaItems.length <= 40) {
|
||||
options.push({
|
||||
text: this.$strings.LabelDownload,
|
||||
action: 'download'
|
||||
})
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
},
|
||||
|
@ -215,6 +224,8 @@ export default {
|
|||
this.batchAutoMatchClick()
|
||||
} else if (action === 'rescan') {
|
||||
this.batchRescan()
|
||||
} else if (action === 'download') {
|
||||
this.batchDownload()
|
||||
}
|
||||
},
|
||||
async batchRescan() {
|
||||
|
@ -241,6 +252,11 @@ export default {
|
|||
}
|
||||
this.$store.commit('globals/setConfirmPrompt', payload)
|
||||
},
|
||||
async batchDownload() {
|
||||
const libraryItemIds = this.selectedMediaItems.map((i) => i.id)
|
||||
console.log('Downloading library items', libraryItemIds)
|
||||
this.$downloadFile(`/api/libraries/${this.$store.state.libraries.currentLibraryId}/download?token=${this.$store.getters['user/getToken']}&ids=${libraryItemIds.join(',')}`)
|
||||
},
|
||||
async playSelectedItems() {
|
||||
this.$store.commit('setProcessingBatch', true)
|
||||
|
||||
|
|
|
@ -74,21 +74,32 @@ export default {
|
|||
this.newPlaylistDescription = this.playlist.description || ''
|
||||
},
|
||||
removeClick() {
|
||||
if (confirm(this.$getString('MessageConfirmRemovePlaylist', [this.playlistName]))) {
|
||||
this.processing = true
|
||||
this.$axios
|
||||
.$delete(`/api/playlists/${this.playlist.id}`)
|
||||
.then(() => {
|
||||
this.processing = false
|
||||
this.show = false
|
||||
this.$toast.success(this.$strings.ToastPlaylistRemoveSuccess)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to remove playlist', error)
|
||||
this.processing = false
|
||||
this.$toast.error(this.$strings.ToastRemoveFailed)
|
||||
})
|
||||
const payload = {
|
||||
message: this.$getString('MessageConfirmRemovePlaylist', [this.playlistName]),
|
||||
callback: (confirmed) => {
|
||||
if (confirmed) {
|
||||
this.removePlaylist()
|
||||
}
|
||||
},
|
||||
type: 'yesNo'
|
||||
}
|
||||
this.$store.commit('globals/setConfirmPrompt', payload)
|
||||
},
|
||||
removePlaylist() {
|
||||
this.processing = true
|
||||
this.$axios
|
||||
.$delete(`/api/playlists/${this.playlist.id}`)
|
||||
.then(() => {
|
||||
this.show = false
|
||||
this.$toast.success(this.$strings.ToastPlaylistRemoveSuccess)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to remove playlist', error)
|
||||
this.$toast.error(this.$strings.ToastRemoveFailed)
|
||||
})
|
||||
.finally(() => {
|
||||
this.processing = false
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
if (this.newPlaylistName === this.playlistName && this.newPlaylistDescription === this.playlist.description) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue