mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-30 01:15:24 +02:00
added download to frontend
This commit is contained in:
parent
0123dacb29
commit
0a9a846a33
@ -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(',')}`, null, true)
|
||||
},
|
||||
async playSelectedItems() {
|
||||
this.$store.commit('setProcessingBatch', true)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user