updated interop function for more capability, search now takes to album instead of playing song

This commit is contained in:
Core 2022-09-11 05:31:44 +01:00
parent 3fa9cde25e
commit 5d658ed990
No known key found for this signature in database
GPG key ID: 2AB8327FBA02D1C0
2 changed files with 45 additions and 22 deletions

View file

@ -2145,6 +2145,18 @@ const app = new Vue({
}
// app.getTypeFromID((kind), (id), (isLibrary), params);
} else if (kind.toString().includes("song")) {
const albumUrl = new Promise(async (resolve, reject) => {
resolve(await MusicKitInterop.fetchSongRelationships({id: id, relationship: "album"}));
});
albumUrl.then((data) => {
if (data && data.type === "albums" && data.id) {
window.location.hash = `album/${data.id}${isLibrary ? "/" + isLibrary : ""}`;
} else {
app.playMediaItemById(id, kind, isLibrary, item.attributes.url ?? "");
}
})
} else {
app.playMediaItemById(id, kind, isLibrary, item.attributes.url ?? "");
}
@ -4542,8 +4554,8 @@ const app = new Vue({
if (app.mk.nowPlayingItem.relationships.artists.data[0].id) {
app.appRoute(`artist/${app.mk.nowPlayingItem.relationships.artists.data[0].id}`);
} else {
const id = await MusicKitInterop.fetchPrimaryArtist("id");
app.appRoute(`artist/${id}`);
const primaryArtist = await MusicKitInterop.fetchSongRelationships({ relationship: "primaryArtist"})
app.appRoute(`artist/${primaryArtist.id}`);
}
},
},