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:
advplyr
2021-10-28 09:37:31 -05:00
parent de4340487b
commit ebf628315c
17 changed files with 727 additions and 502 deletions
+6 -15
View File
@@ -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
View File
@@ -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
}
}