Merge pull request #236 from yazninja/upcoming

[DiscordRPC] Add storefront/ Fix songs with no catalog ID
This commit is contained in:
cryptofyre 2022-01-27 22:32:09 -06:00 committed by GitHub
commit 92fc5798ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -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}` : ''}`,

View file

@ -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: '' };