mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-27 22:04:08 +02:00
Add download UI indicator, download progress, update bookshelf item to show local items and items matches with local item, remove item before downloading if already exists in file system
This commit is contained in:
+15
-2
@@ -1,8 +1,11 @@
|
||||
export const state = () => ({
|
||||
|
||||
itemDownloads: []
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
getDownloadItem: state => libraryItemId => {
|
||||
return state.itemDownloads.find(i => i.id == libraryItemId)
|
||||
},
|
||||
getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder = '/book_placeholder.jpg') => {
|
||||
if (!libraryItem) return placeholder
|
||||
var media = libraryItem.media
|
||||
@@ -28,5 +31,15 @@ export const actions = {
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
|
||||
addUpdateItemDownload(state, downloadItem) {
|
||||
var index = state.itemDownloads.findIndex(i => i.id == downloadItem.id)
|
||||
if (index >= 0) {
|
||||
state.itemDownloads.splice(index, 1, downloadItem)
|
||||
} else {
|
||||
state.itemDownloads.push(downloadItem)
|
||||
}
|
||||
},
|
||||
removeItemDownload(state, id) {
|
||||
state.itemDownloads = state.itemDownloads.filter(i => i.id != id)
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,10 @@ export const getters = {
|
||||
getCurrentLibraryName: (state, getters) => {
|
||||
var currLib = getters.getCurrentLibrary
|
||||
return currLib ? currLib.name : null
|
||||
},
|
||||
getCurrentLibraryMediaType: (state, getters) => {
|
||||
var currLib = getters.getCurrentLibrary
|
||||
return currLib ? currLib.mediaType : null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user