Fix refreshPlaylist using outdated cache (#1000)
This commit is contained in:
parent
40c8f40422
commit
3f0302ccc0
1 changed files with 26 additions and 20 deletions
|
@ -1134,28 +1134,31 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async refreshPlaylists(localOnly = false) {
|
async refreshPlaylists(localOnly = false, useCachedPlaylists = true) {
|
||||||
let self = this
|
let self = this
|
||||||
let trackMap = this.cfg.advanced.playlistTrackMapping
|
let trackMap = this.cfg.advanced.playlistTrackMapping
|
||||||
let newListing = []
|
let newListing = []
|
||||||
let trackMapping = {}
|
let trackMapping = {}
|
||||||
const cachedPlaylist = await CiderCache.getCache("library-playlists")
|
|
||||||
const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks")
|
|
||||||
|
|
||||||
if (cachedPlaylist) {
|
if (useCachedPlaylists) {
|
||||||
console.debug("using cached playlists")
|
const cachedPlaylist = await CiderCache.getCache("library-playlists")
|
||||||
this.playlists.listing = cachedPlaylist
|
const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks")
|
||||||
self.sortPlaylists()
|
|
||||||
} else {
|
|
||||||
console.debug("playlist has no cache")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cachedTrackMapping) {
|
if (cachedPlaylist) {
|
||||||
console.debug("using cached track mapping")
|
console.debug("using cached playlists")
|
||||||
this.playlists.trackMapping = cachedTrackMapping
|
this.playlists.listing = cachedPlaylist
|
||||||
}
|
self.sortPlaylists()
|
||||||
if (localOnly) {
|
} else {
|
||||||
return
|
console.debug("playlist has no cache")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cachedTrackMapping) {
|
||||||
|
console.debug("using cached track mapping")
|
||||||
|
this.playlists.trackMapping = cachedTrackMapping
|
||||||
|
}
|
||||||
|
if (localOnly) {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.library.backgroundNotification.message = "Building playlist cache..."
|
this.library.backgroundNotification.message = "Building playlist cache..."
|
||||||
|
@ -1260,7 +1263,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).then(res => {
|
).then(res => {
|
||||||
self.refreshPlaylists()
|
self.refreshPlaylists(false, false)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async editPlaylist(id, name = app.getLz('term.newPlaylist')) {
|
async editPlaylist(id, name = app.getLz('term.newPlaylist')) {
|
||||||
|
@ -1275,7 +1278,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).then(res => {
|
).then(res => {
|
||||||
self.refreshPlaylists()
|
self.refreshPlaylists(false, false)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
copyToClipboard(str) {
|
copyToClipboard(str) {
|
||||||
|
@ -1319,7 +1322,7 @@ const app = new Vue({
|
||||||
})
|
})
|
||||||
self.sortPlaylists()
|
self.sortPlaylists()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
app.refreshPlaylists()
|
app.refreshPlaylists(false, false)
|
||||||
}, 8000)
|
}, 8000)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -1336,6 +1339,9 @@ const app = new Vue({
|
||||||
if (found) {
|
if (found) {
|
||||||
self.playlists.listing.splice(self.playlists.listing.indexOf(found), 1)
|
self.playlists.listing.splice(self.playlists.listing.indexOf(found), 1)
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
app.refreshPlaylists(false, false);
|
||||||
|
}, 8000);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2581,7 +2587,7 @@ const app = new Vue({
|
||||||
})
|
})
|
||||||
self.sortPlaylists()
|
self.sortPlaylists()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
app.refreshPlaylists()
|
app.refreshPlaylists(false, false)
|
||||||
}, 13000)
|
}, 13000)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue