inf loof fix

This commit is contained in:
child_duckling 2022-01-16 19:19:26 -08:00
parent 6b82771697
commit abd24a65cb

View file

@ -483,7 +483,7 @@ const app = new Vue({
this.mk = MusicKit.getInstance() this.mk = MusicKit.getInstance()
this.mk.authorize().then(() => { this.mk.authorize().then(() => {
self.mkIsReady = true self.mkIsReady = true
document.location.reload() //document.location.reload()
}) })
this.$forceUpdate() this.$forceUpdate()
if (this.isDev) { if (this.isDev) {
@ -560,7 +560,8 @@ const app = new Vue({
let kind = lastItem.attributes.playParams.kind; let kind = lastItem.attributes.playParams.kind;
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
app.mk.setQueue({ app.mk.setQueue({
[truekind]: [lastItem.attributes.playParams.id] }) [truekind]: [lastItem.attributes.playParams.id]
})
app.mk.mute() app.mk.mute()
setTimeout(() => { setTimeout(() => {
app.mk.play().then(() => { app.mk.play().then(() => {
@ -2411,7 +2412,8 @@ const app = new Vue({
}); });
} else { } else {
this.mk.setQueue({ this.mk.setQueue({
[truekind]: [id] }).then(function(queue) { [truekind]: [id]
}).then(function(queue) {
MusicKit.getInstance().play() MusicKit.getInstance().play()
}) })
} }
@ -2457,7 +2459,8 @@ const app = new Vue({
app.mk.changeToMediaAtIndex(childIndex) app.mk.changeToMediaAtIndex(childIndex)
} else if (item) { } else if (item) {
app.mk.playNext({ app.mk.playNext({
[item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id }).then(function() { [item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id
}).then(function() {
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1) app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1)
app.mk.play() app.mk.play()
}) })
@ -2470,7 +2473,8 @@ const app = new Vue({
app.mk.stop().then(() => { app.mk.stop().then(() => {
if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))) { if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))) {
app.mk.setQueue({ app.mk.setQueue({
[item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id }).then(function() { [item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id
}).then(function() {
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1).then(function() { app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1).then(function() {
if ((app.showingPlaylist && app.showingPlaylist.id == id)) { if ((app.showingPlaylist && app.showingPlaylist.id == id)) {
let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
@ -2494,7 +2498,8 @@ const app = new Vue({
}) })
} else { } else {
this.mk.setQueue({ this.mk.setQueue({
[truekind]: [id] }).then(function(queue) { [truekind]: [id]
}).then(function(queue) {
if (item && ((queue._itemIDs[childIndex] != item.id))) { if (item && ((queue._itemIDs[childIndex] != item.id))) {
childIndex = queue._itemIDs.indexOf(item.id) childIndex = queue._itemIDs.indexOf(item.id)
} }
@ -2502,7 +2507,8 @@ const app = new Vue({
app.mk.changeToMediaAtIndex(childIndex) app.mk.changeToMediaAtIndex(childIndex)
} else if (item) { } else if (item) {
app.mk.playNext({ app.mk.playNext({
[item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id }).then(function() { [item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id
}).then(function() {
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1) app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1)
app.mk.play() app.mk.play()
}) })
@ -2627,8 +2633,11 @@ const app = new Vue({
types[index].id.push(id) types[index].id.push(id)
} }
} }
types2 = types.map(function(item) { return { types2 = types.map(function(item) {
[`ids[${item.type}]`]: [item.id] } }) return {
[`ids[${item.type}]`]: [item.id]
}
})
types2 = types2.reduce(function(result, item) { types2 = types2.reduce(function(result, item) {
var key = Object.keys(item)[0]; //first property: a, b, c var key = Object.keys(item)[0]; //first property: a, b, c
result[key] = item[key]; result[key] = item[key];