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.compactUI": "Compact UI",
|
||||||
"settings.option.experimental.close_button_hide": "Close Button Should Hide the Application",
|
"settings.option.experimental.close_button_hide": "Close Button Should Hide the Application",
|
||||||
"settings.option.experimental.inline_playlists": "Inline Playlists and Albums",
|
"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.notTurnedOn": "Audio Spatialization is disabled. To use, please enable it first.",
|
||||||
"spatial.spatialProperties": "Spatial Properties",
|
"spatial.spatialProperties": "Spatial Properties",
|
||||||
"spatial.width": "Width",
|
"spatial.width": "Width",
|
||||||
|
|
|
@ -352,6 +352,8 @@
|
||||||
"settings.option.experimental.compactUI": "Compact UI",
|
"settings.option.experimental.compactUI": "Compact UI",
|
||||||
"settings.option.experimental.close_button_hide": "Close Button Should Hide the Application",
|
"settings.option.experimental.close_button_hide": "Close Button Should Hide the Application",
|
||||||
"settings.option.experimental.inline_playlists": "Inline Playlists and Albums",
|
"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.notTurnedOn": "Audio Spatialization is disabled. To use, please enable it first.",
|
||||||
"spatial.spatialProperties": "Spatial Properties",
|
"spatial.spatialProperties": "Spatial Properties",
|
||||||
"spatial.width": "Width",
|
"spatial.width": "Width",
|
||||||
|
|
|
@ -118,7 +118,8 @@ export class Store {
|
||||||
},
|
},
|
||||||
"advanced": {
|
"advanced": {
|
||||||
"AudioContext": false,
|
"AudioContext": false,
|
||||||
"experiments": []
|
"experiments": [],
|
||||||
|
"playlistTrackMapping": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private migrations: any = {}
|
private migrations: any = {}
|
||||||
|
|
|
@ -15,6 +15,7 @@ const CiderCache = {
|
||||||
return cache
|
return cache
|
||||||
},
|
},
|
||||||
async putCache(file, data) {
|
async putCache(file, data) {
|
||||||
|
console.log(`Caching ${file}`)
|
||||||
ipcRenderer.invoke("put-cache", {
|
ipcRenderer.invoke("put-cache", {
|
||||||
file: file,
|
file: file,
|
||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
|
@ -201,7 +202,8 @@ const app = new Vue({
|
||||||
listing: [],
|
listing: [],
|
||||||
details: {},
|
details: {},
|
||||||
loadingState: 0, // 0 loading, 1 loaded, 2 error
|
loadingState: 0, // 0 loading, 1 loaded, 2 error
|
||||||
id: ""
|
id: "",
|
||||||
|
trackMapping: {}
|
||||||
},
|
},
|
||||||
webremoteurl: "",
|
webremoteurl: "",
|
||||||
webremoteqr: "",
|
webremoteqr: "",
|
||||||
|
@ -398,7 +400,7 @@ const app = new Vue({
|
||||||
} else if (gp.axes[3] < -stickDeadZone) {
|
} else if (gp.axes[3] < -stickDeadZone) {
|
||||||
$(scrollGroupY).scrollTop($(scrollGroupY).scrollTop() + (gp.axes[3] * scrollSpeed))
|
$(scrollGroupY).scrollTop($(scrollGroupY).scrollTop() + (gp.axes[3] * scrollSpeed))
|
||||||
elementFocusEnabled = false
|
elementFocusEnabled = false
|
||||||
}else {
|
} else {
|
||||||
elementFocusEnabled = true
|
elementFocusEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1400,10 +1402,12 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async refreshPlaylists(localOnly = false) {
|
async refreshPlaylists(localOnly = false, trackMap = true) {
|
||||||
let self = this
|
let self = this
|
||||||
let newListing = []
|
let newListing = []
|
||||||
|
let trackMapping = {}
|
||||||
const cachedPlaylist = await CiderCache.getCache("library-playlists")
|
const cachedPlaylist = await CiderCache.getCache("library-playlists")
|
||||||
|
const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks")
|
||||||
|
|
||||||
if (cachedPlaylist) {
|
if (cachedPlaylist) {
|
||||||
console.log("using cached playlists")
|
console.log("using cached playlists")
|
||||||
|
@ -1412,7 +1416,12 @@ const app = new Vue({
|
||||||
} else {
|
} else {
|
||||||
console.log("playlist has no cache")
|
console.log("playlist has no cache")
|
||||||
}
|
}
|
||||||
if(localOnly) {
|
|
||||||
|
if(cachedTrackMapping) {
|
||||||
|
console.log("using cached track mapping")
|
||||||
|
this.playlists.trackMapping = cachedTrackMapping
|
||||||
|
}
|
||||||
|
if (localOnly) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1427,12 +1436,26 @@ const app = new Vue({
|
||||||
playlist.children = []
|
playlist.children = []
|
||||||
playlist.tracks = []
|
playlist.tracks = []
|
||||||
try {
|
try {
|
||||||
|
if (trackMap) {
|
||||||
let tracks = await app.mk.api.v3.music(playlist.href + "/tracks").catch(e => {
|
let tracks = await app.mk.api.v3.music(playlist.href + "/tracks").catch(e => {
|
||||||
// no tracks
|
// no tracks
|
||||||
|
e = null
|
||||||
})
|
})
|
||||||
playlist.tracks = tracks.data
|
tracks.data.data.forEach(track => {
|
||||||
} catch (e) { }
|
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") {
|
if (playlist.type == "library-playlist-folders") {
|
||||||
try {
|
try {
|
||||||
await deepScan(playlist.id).catch(e => { })
|
await deepScan(playlist.id).catch(e => { })
|
||||||
|
@ -1449,6 +1472,10 @@ const app = new Vue({
|
||||||
this.library.backgroundNotification.show = false
|
this.library.backgroundNotification.show = false
|
||||||
this.playlists.listing = newListing
|
this.playlists.listing = newListing
|
||||||
self.sortPlaylists()
|
self.sortPlaylists()
|
||||||
|
if (trackMap) {
|
||||||
|
CiderCache.putCache("library-playlists-tracks", trackMapping)
|
||||||
|
this.playlists.trackMapping = trackMapping
|
||||||
|
}
|
||||||
CiderCache.putCache("library-playlists", newListing)
|
CiderCache.putCache("library-playlists", newListing)
|
||||||
},
|
},
|
||||||
sortPlaylists() {
|
sortPlaylists() {
|
||||||
|
|
|
@ -673,6 +673,17 @@
|
||||||
</div>
|
</div>
|
||||||
</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-line">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue