Add storefront/ Fix songs with no catalog ID
This commit is contained in:
parent
ea1e4cb2da
commit
5eec89eb72
2 changed files with 11 additions and 2 deletions
|
@ -102,7 +102,15 @@ export default class DiscordRichPresence {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const listenURL = `https://cider.sh/p?s&id=${attributes.playParams.id}` // cider://play/s/[id] (for song)
|
const listenURL = `https://cider.sh/p?s&id=${attributes.playParams.id}` // cider://play/s/[id] (for song)
|
||||||
const AMWebURL = `https://music.apple.com/us/song/${attributes.playParams.catalogId}`
|
let AMWebURL = '';
|
||||||
|
if(attributes.playParams.catalogId == null){
|
||||||
|
AMWebURL = `https://music.apple.com/${attributes.storefrontId}/song/${attributes.playParams.id}`
|
||||||
|
console.log("No Catalog ID");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AMWebURL = `https://music.apple.com/${attributes.storefrontId}/song/${attributes.playParams.catalogId}`
|
||||||
|
}
|
||||||
|
console.log("DiscordRPC URL: ", AMWebURL);
|
||||||
this._activity = {
|
this._activity = {
|
||||||
details: attributes.name,
|
details: attributes.name,
|
||||||
state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`,
|
state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`,
|
||||||
|
|
|
@ -43,7 +43,8 @@ const MusicKitInterop = {
|
||||||
const isPlayingExport = MusicKit.getInstance().isPlaying;
|
const isPlayingExport = MusicKit.getInstance().isPlaying;
|
||||||
const remainingTimeExport = MusicKit.getInstance().currentPlaybackTimeRemaining;
|
const remainingTimeExport = MusicKit.getInstance().currentPlaybackTimeRemaining;
|
||||||
const attributes = (nowPlayingItem != null ? nowPlayingItem.attributes : {});
|
const attributes = (nowPlayingItem != null ? nowPlayingItem.attributes : {});
|
||||||
|
const storefrontId = MusicKit.getInstance().storefrontId;
|
||||||
|
attributes.storefrontId = storefrontId;
|
||||||
attributes.status = isPlayingExport ?? false;
|
attributes.status = isPlayingExport ?? false;
|
||||||
attributes.name = attributes?.name ?? 'No Title Found';
|
attributes.name = attributes?.name ?? 'No Title Found';
|
||||||
attributes.artwork = attributes?.artwork ?? { url: '' };
|
attributes.artwork = attributes?.artwork ?? { url: '' };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue