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}`, {
|
const res = await MusicKit.getInstance().api.v3.music("/v1/catalog/" + MusicKit.getInstance().storefrontId + `/songs/${id}`, {
|
||||||
include: {
|
include: {
|
||||||
songs: ["artists"],
|
songs: ["artists"],
|
||||||
|
@ -92,14 +93,14 @@ const MusicKitInterop = {
|
||||||
|
|
||||||
if (!res || !res.data) {
|
if (!res || !res.data) {
|
||||||
console.warn("[cider:preload] fetchSongRelationships: no response");
|
console.warn("[cider:preload] fetchSongRelationships: no response");
|
||||||
if (id === app.mk.nowPlayingItem.attributes.playParams.catalogId || id === app.mk.nowPlayingItem.attributes.playParams.id) {
|
if (id === this.getAttributes().songId) {
|
||||||
return app.mk.nowPlayingItem.attributes.artistName;
|
return this.getAttributes().artistName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!res.data.data.length) {
|
if (!res.data.data.length) {
|
||||||
console.error(`[cider:preload] fetchSongRelationships: Unable to locate song with id of ${id}`);
|
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) {
|
if (id === this.getAttributes().songId) {
|
||||||
return app.mk.nowPlayingItem.attributes.artistName;
|
return this.getAttributes().artistName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue