Add back in m4b merge downloader in experimental #478

This commit is contained in:
advplyr 2022-04-21 18:52:28 -05:00
parent f781fa9e6b
commit ad3fbe7abf
12 changed files with 611 additions and 297 deletions

View file

@ -4,8 +4,8 @@ export const state = () => ({
})
export const getters = {
getDownloads: (state) => (audiobookId) => {
return state.downloads.filter(d => d.audiobookId === audiobookId)
getDownloads: (state) => (libraryItemId) => {
return state.downloads.filter(d => d.libraryItemId === libraryItemId)
},
getDownload: (state) => (id) => {
return state.downloads.find(d => d.id === id)
@ -17,15 +17,10 @@ export const actions = {
}
export const mutations = {
setDownloads(state, downloads) {
state.downloads = downloads
},
addUpdateDownload(state, download) {
// Remove older downloads of matching type
state.downloads = state.downloads.filter(d => {
if (d.id !== download.id && d.type === download.type) {
return false
}
return true
})
var index = state.downloads.findIndex(d => d.id === download.id)
if (index >= 0) {
state.downloads.splice(index, 1, download)