simplified preload function
Signed-off-by: Core <core@coredev.uk>
This commit is contained in:
parent
fff57f23ac
commit
3b46a623cd
1 changed files with 6 additions and 5 deletions
|
@ -83,7 +83,8 @@ const MusicKitInterop = {
|
|||
});
|
||||
},
|
||||
|
||||
async fetchSongRelationships({ id = app.mk.nowPlayingItem.attributes.playParams.catalogId || app.mk.nowPlayingItem.attributes.playParams.id, relationship = "primaryName" } = {}) {
|
||||
async fetchSongRelationships({ id = this.getAttributes().songId, relationship = "primaryName" } = {}) {
|
||||
if (!id) return null;
|
||||
const res = await MusicKit.getInstance().api.v3.music("/v1/catalog/" + MusicKit.getInstance().storefrontId + `/songs/${id}`, {
|
||||
include: {
|
||||
songs: ["artists"],
|
||||
|
@ -92,14 +93,14 @@ const MusicKitInterop = {
|
|||
|
||||
if (!res || !res.data) {
|
||||
console.warn("[cider:preload] fetchSongRelationships: no response");
|
||||
if (id === app.mk.nowPlayingItem.attributes.playParams.catalogId || id === app.mk.nowPlayingItem.attributes.playParams.id) {
|
||||
return app.mk.nowPlayingItem.attributes.artistName;
|
||||
if (id === this.getAttributes().songId) {
|
||||
return this.getAttributes().artistName;
|
||||
}
|
||||
}
|
||||
if (!res.data.data.length) {
|
||||
console.error(`[cider:preload] fetchSongRelationships: Unable to locate song with id of ${id}`);
|
||||
if (id === app.mk.nowPlayingItem.attributes.playParams.catalogId || id === app.mk.nowPlayingItem.attributes.playParams.id) {
|
||||
return app.mk.nowPlayingItem.attributes.artistName;
|
||||
if (id === this.getAttributes().songId) {
|
||||
return this.getAttributes().artistName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue