revert some queue extension tricks as MKjs does not like it
This commit is contained in:
parent
4a9ddd0f3a
commit
c07d650a69
4 changed files with 163 additions and 190 deletions
|
@ -63,7 +63,7 @@
|
|||
Play
|
||||
</button>
|
||||
<button class="wr-btn" style="min-width: 120px;"
|
||||
@click="shufflePlay()">
|
||||
@click="app.mk.shuffleMode = 1; app.mk.stop().then(function() {app.playMediaItemById(data.attributes.playParams.id ?? data.id, data.attributes.playParams.kind ?? data.type, data.attributes.playParams.isLibrary ?? false, data.attributes.url)})">
|
||||
Shuffle
|
||||
</button>
|
||||
<button class="wr-btn" style="min-width: 120px;" v-if="inLibrary!=null"
|
||||
|
@ -323,72 +323,35 @@
|
|||
array[j] = temp;
|
||||
}
|
||||
}
|
||||
var id = this.data.attributes.playParams.id ?? this.data.id
|
||||
let kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
|
||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||
let isLibrary = this.data.attributes.playParams ? (this.data.attributes.playParams.isLibrary ?? false) : false;
|
||||
app.mk.stop().then(function() {
|
||||
app.mk.clearQueue().then(function () {
|
||||
app.mk.setQueue({ [truekind] : [id] }).then(function () {
|
||||
//var id = this.data.attributes.playParams.id ?? this.data.id;
|
||||
//console.log("1")
|
||||
var kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
|
||||
//console.log("1")
|
||||
var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||
// console.log("1")
|
||||
// var isLibrary = this.data.attributes.playParams ? (this.data.attributes.playParams.isLibrary ?? false) : false;
|
||||
console.log("1")
|
||||
app.mk.stop().then(function () {
|
||||
console.log("2")
|
||||
app.mk.setQueue({ [truekind]: [id] }).then(function () {
|
||||
app.mk.play().then(function () {
|
||||
app.mk.clearQueue().then(function () {
|
||||
const params = {
|
||||
// include: "tracks",
|
||||
// platform: "web",
|
||||
// "include[library-playlists]": "catalog,tracks",
|
||||
// "fields[playlists]": "curatorName,playlistType,name,artwork,url",
|
||||
// "include[library-songs]": "catalog,artists,albums",
|
||||
// "fields[catalog]": "artistUrl,albumUrl",
|
||||
// "fields[songs]": "artistUrl,albumUrl, playParams"
|
||||
}
|
||||
function getList(kind, id, params, isLibrary) {
|
||||
if (kind.includes("album")){
|
||||
if (isLibrary) {
|
||||
return app.mk.api.library.album(id, params)
|
||||
} else { return app.mk.api.album(id, params) }
|
||||
} else {
|
||||
if (isLibrary) {
|
||||
return app.mk.api.library.playlist(id, params)
|
||||
} else { return app.mk.api.playlist(id, params) }}
|
||||
}
|
||||
try {
|
||||
|
||||
getList(kind, id, params, isLibrary).then(res => {
|
||||
console.log(res)
|
||||
let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
|
||||
if (app.mk.shuffleMode == 1) { shuffleArray(query); console.log('shf') }
|
||||
if (!kind.includes("album"))
|
||||
app.mk.clearQueue().then(function () {
|
||||
try {
|
||||
let query = (this.data ?? app.showingPlaylist).relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
|
||||
if (app.mk.shuffleMode == 1) { shuffleArray(query) }
|
||||
app.mk.queue.append(query)
|
||||
if (!res.relationships.tracks.next) {
|
||||
return
|
||||
} else {
|
||||
getPlaylistTracks(res.relationships.tracks.next)
|
||||
}
|
||||
|
||||
function getPlaylistTracks(next) {
|
||||
app.apiCall(app.musicBaseUrl + next, res => {
|
||||
// if (res.id != playlistId) {
|
||||
// return
|
||||
// }
|
||||
let query = res.data.map(item => new MusicKit.MediaItem(item))
|
||||
if (app.mk.shuffleMode == 1) { shuffleArray(query); console.log('shf') }
|
||||
app.mk.queue.append(query)
|
||||
|
||||
if (res.next) {
|
||||
getPlaylistTracks(res.next)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch (e) {console.log(e) }
|
||||
} catch (e) { console.log(e) }
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue