mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-27 05:43:58 +02:00
Fix: download single track audiobooks #15, Change: check write permission when selecting folder #13, Add: Show folders and files list in user selected folder, Fix: Seek back only if audiobook was played #20
This commit is contained in:
+6
-15
@@ -1,6 +1,5 @@
|
||||
export const state = () => ({
|
||||
downloads: [],
|
||||
orphanDownloads: [],
|
||||
showModal: false
|
||||
})
|
||||
|
||||
@@ -45,24 +44,16 @@ export const mutations = {
|
||||
}
|
||||
},
|
||||
addUpdateDownload(state, download) {
|
||||
var key = download.isOrphan ? 'orphanDownloads' : 'downloads'
|
||||
var index = state[key].findIndex(d => d.id === download.id)
|
||||
var index = state.downloads.findIndex(d => d.id === download.id)
|
||||
if (index >= 0) {
|
||||
state[key].splice(index, 1, download)
|
||||
state.downloads.splice(index, 1, download)
|
||||
} else {
|
||||
state[key].push(download)
|
||||
}
|
||||
|
||||
if (key === 'downloads') {
|
||||
this.$sqlStore.setDownload(download)
|
||||
state.downloads.push(download)
|
||||
}
|
||||
this.$sqlStore.setDownload(download)
|
||||
},
|
||||
removeDownload(state, download) {
|
||||
var key = download.isOrphan ? 'orphanDownloads' : 'downloads'
|
||||
state[key] = state[key].filter(d => d.id !== download.id)
|
||||
|
||||
if (key === 'downloads') {
|
||||
this.$sqlStore.removeDownload(download.id)
|
||||
}
|
||||
state.downloads = state.downloads.filter(d => d.id !== download.id)
|
||||
this.$sqlStore.removeDownload(download.id)
|
||||
}
|
||||
}
|
||||
+9
-1
@@ -13,7 +13,9 @@ export const state = () => ({
|
||||
isFirstLoad: true,
|
||||
hasStoragePermission: false,
|
||||
selectedBook: null,
|
||||
showReader: false
|
||||
showReader: false,
|
||||
downloadFolder: null,
|
||||
mediaScanResults: {}
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
@@ -89,5 +91,11 @@ export const mutations = {
|
||||
},
|
||||
setShowReader(state, val) {
|
||||
state.showReader = val
|
||||
},
|
||||
setDownloadFolder(state, val) {
|
||||
state.downloadFolder = val
|
||||
},
|
||||
setMediaScanResults(state, val) {
|
||||
state.mediaScanResults = val
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user