adds playlist track mapping
This commit is contained in:
parent
9f81aa9ad2
commit
6924c76f4c
5 changed files with 55 additions and 12 deletions
|
@ -352,6 +352,8 @@
|
|||
"settings.option.experimental.compactUI": "Compact UI",
|
||||
"settings.option.experimental.close_button_hide": "Close Button Should Hide the Application",
|
||||
"settings.option.experimental.inline_playlists": "Inline Playlists and Albums",
|
||||
"settings.option.advanced.playlistTrackMapping": "Playlist Track Mapping",
|
||||
"settings.option.advanced.playlistTrackMapping.description": "Enables deep scanning of playlists to determine which tracks are in which playlists.",
|
||||
"spatial.notTurnedOn": "Audio Spatialization is disabled. To use, please enable it first.",
|
||||
"spatial.spatialProperties": "Spatial Properties",
|
||||
"spatial.width": "Width",
|
||||
|
|
|
@ -352,6 +352,8 @@
|
|||
"settings.option.experimental.compactUI": "Compact UI",
|
||||
"settings.option.experimental.close_button_hide": "Close Button Should Hide the Application",
|
||||
"settings.option.experimental.inline_playlists": "Inline Playlists and Albums",
|
||||
"settings.option.advanced.playlistTrackMapping": "Playlist Track Mapping",
|
||||
"settings.option.advanced.playlistTrackMapping.description": "Enables deep scanning of playlists to determine which tracks are in which playlists.",
|
||||
"spatial.notTurnedOn": "Audio Spatialization is disabled. To use, please enable it first.",
|
||||
"spatial.spatialProperties": "Spatial Properties",
|
||||
"spatial.width": "Width",
|
||||
|
|
|
@ -118,7 +118,8 @@ export class Store {
|
|||
},
|
||||
"advanced": {
|
||||
"AudioContext": false,
|
||||
"experiments": []
|
||||
"experiments": [],
|
||||
"playlistTrackMapping": true
|
||||
}
|
||||
}
|
||||
private migrations: any = {}
|
||||
|
|
|
@ -15,6 +15,7 @@ const CiderCache = {
|
|||
return cache
|
||||
},
|
||||
async putCache(file, data) {
|
||||
console.log(`Caching ${file}`)
|
||||
ipcRenderer.invoke("put-cache", {
|
||||
file: file,
|
||||
data: JSON.stringify(data)
|
||||
|
@ -201,7 +202,8 @@ const app = new Vue({
|
|||
listing: [],
|
||||
details: {},
|
||||
loadingState: 0, // 0 loading, 1 loaded, 2 error
|
||||
id: ""
|
||||
id: "",
|
||||
trackMapping: {}
|
||||
},
|
||||
webremoteurl: "",
|
||||
webremoteqr: "",
|
||||
|
@ -388,7 +390,7 @@ const app = new Vue({
|
|||
if (cursorPos[1] > window.innerHeight - cursorSize) {
|
||||
cursorPos[1] = window.innerHeight - cursorSize
|
||||
}
|
||||
|
||||
|
||||
|
||||
// RIGHT STICK.
|
||||
if (scrollGroupY) {
|
||||
|
@ -398,10 +400,10 @@ const app = new Vue({
|
|||
} else if (gp.axes[3] < -stickDeadZone) {
|
||||
$(scrollGroupY).scrollTop($(scrollGroupY).scrollTop() + (gp.axes[3] * scrollSpeed))
|
||||
elementFocusEnabled = false
|
||||
}else {
|
||||
} else {
|
||||
elementFocusEnabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1400,10 +1402,12 @@ const app = new Vue({
|
|||
}
|
||||
})
|
||||
},
|
||||
async refreshPlaylists(localOnly = false) {
|
||||
async refreshPlaylists(localOnly = false, trackMap = true) {
|
||||
let self = this
|
||||
let newListing = []
|
||||
let trackMapping = {}
|
||||
const cachedPlaylist = await CiderCache.getCache("library-playlists")
|
||||
const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks")
|
||||
|
||||
if (cachedPlaylist) {
|
||||
console.log("using cached playlists")
|
||||
|
@ -1412,7 +1416,12 @@ const app = new Vue({
|
|||
} else {
|
||||
console.log("playlist has no cache")
|
||||
}
|
||||
if(localOnly) {
|
||||
|
||||
if(cachedTrackMapping) {
|
||||
console.log("using cached track mapping")
|
||||
this.playlists.trackMapping = cachedTrackMapping
|
||||
}
|
||||
if (localOnly) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1427,12 +1436,26 @@ const app = new Vue({
|
|||
playlist.children = []
|
||||
playlist.tracks = []
|
||||
try {
|
||||
let tracks = await app.mk.api.v3.music(playlist.href + "/tracks").catch(e => {
|
||||
// no tracks
|
||||
})
|
||||
playlist.tracks = tracks.data
|
||||
} catch (e) { }
|
||||
if (trackMap) {
|
||||
let tracks = await app.mk.api.v3.music(playlist.href + "/tracks").catch(e => {
|
||||
// no tracks
|
||||
e = null
|
||||
})
|
||||
tracks.data.data.forEach(track => {
|
||||
if (!trackMapping[track.id]) {
|
||||
trackMapping[track.id] = []
|
||||
}
|
||||
trackMapping[track.id].push(playlist.id)
|
||||
|
||||
if (typeof track.attributes.playParams.catalogId == "string") {
|
||||
if (!trackMapping[track.attributes.playParams.catalogId]) {
|
||||
trackMapping[track.attributes.playParams.catalogId] = []
|
||||
}
|
||||
trackMapping[track.attributes.playParams.catalogId].push(playlist.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (e) { }
|
||||
if (playlist.type == "library-playlist-folders") {
|
||||
try {
|
||||
await deepScan(playlist.id).catch(e => { })
|
||||
|
@ -1449,6 +1472,10 @@ const app = new Vue({
|
|||
this.library.backgroundNotification.show = false
|
||||
this.playlists.listing = newListing
|
||||
self.sortPlaylists()
|
||||
if (trackMap) {
|
||||
CiderCache.putCache("library-playlists-tracks", trackMapping)
|
||||
this.playlists.trackMapping = trackMapping
|
||||
}
|
||||
CiderCache.putCache("library-playlists", newListing)
|
||||
},
|
||||
sortPlaylists() {
|
||||
|
|
|
@ -673,6 +673,17 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz('settings.option.advanced.playlistTrackMapping')}}
|
||||
<br>
|
||||
<small>{{$root.getLz('settings.option.advanced.playlistTrackMapping.description')}}</small>
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<input type="checkbox" v-model="app.cfg.advanced.playlistTrackMapping" switch/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue