Merge pull request #234 from yazninja/upcoming

Fix discordRPC
This commit is contained in:
cryptofyre 2022-01-27 21:32:23 -06:00 committed by GitHub
commit ea1e4cb2da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -102,6 +102,7 @@ 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}`
this._activity = { this._activity = {
details: attributes.name, details: attributes.name,
state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`, state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`,
@ -113,7 +114,7 @@ export default class DiscordRichPresence {
buttons: [ buttons: [
{label: "Listen on Cider", url: listenURL}, {label: "Listen on Cider", url: listenURL},
{label: "Open In Apple Music", url: attributes.songURL}, {label: "Open In Apple Music", url: AMWebURL},
] ]
}; };

View file

@ -48,7 +48,6 @@ const MusicKitInterop = {
attributes.name = attributes?.name ?? 'No Title Found'; attributes.name = attributes?.name ?? 'No Title Found';
attributes.artwork = attributes?.artwork ?? { url: '' }; attributes.artwork = attributes?.artwork ?? { url: '' };
attributes.artwork.url = (attributes?.artwork?.url ?? '').replace(`{f}`,"png"); attributes.artwork.url = (attributes?.artwork?.url ?? '').replace(`{f}`,"png");
attributes.songUrl = ('https://music.apple.com/song/' + nowPlayingItem?._songId) ?? '';
attributes.playParams = attributes?.playParams ?? { id: 'no-id-found' }; attributes.playParams = attributes?.playParams ?? { id: 'no-id-found' };
attributes.playParams.id = attributes?.playParams?.id ?? 'no-id-found'; attributes.playParams.id = attributes?.playParams?.id ?? 'no-id-found';
if (attributes.playParams.id === 'no-id-found') { attributes.playParams.id = nowPlayingItem?.id ?? 'no-id-found'; } if (attributes.playParams.id === 'no-id-found') { attributes.playParams.id = nowPlayingItem?.id ?? 'no-id-found'; }