mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-07-09 17:28:28 +00:00
refactor(discord): Update links and art
* Use pocike icon for placeholder art * Use MS logo for small art with link to docs * Use web link as track url, if available * Use MB link as track or artist url
This commit is contained in:
parent
ea5b66cdae
commit
2a2fb9ad55
7 changed files with 19 additions and 19 deletions
1
assets/README.md
Normal file
1
assets/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Attribution for [`default-artwork.png`](/assets/default-artwork.png): https://www.flaticon.com/free-icon/music_15795471
|
||||
BIN
assets/default-artwork.png
Normal file
BIN
assets/default-artwork.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -11,7 +11,7 @@ import JsonConfig from '!!raw-loader!@site/../config/discord.json.example';
|
|||
|
||||
This scrobbler uses **[Now Playing](/configuration/clients#now-playing)** functionality to set your Discord [Rich Presence](https://docs.discord.com/developers/rich-presence/overview) to the music you are currently monitoring with multi-scrobbler.
|
||||
|
||||
<img src={require('/img/discord_presence.png').default} height="131"/>
|
||||
<img src={require('/img/discord_presence_art.png').default} height="127"/>
|
||||
|
||||
:::warning[Discord TOS Violation]
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ Discord needs an **external, internet-facing** URL to correctly display this ima
|
|||
<TabItem label="Discord Default" value="discord-default">
|
||||
When [**Application Id**](#discord-application) is **not** configured Discord will show its own default image.
|
||||
|
||||
<img src={require('/img/discord_presence_default.png').default} height="127"/>
|
||||
<img src={require('/img/discord_presence_discord_default.png').default} height="127"/>
|
||||
</TabItem>
|
||||
<TabItem label="MS Default" value="ms-default">
|
||||
When [**Application Id**](#discord-application) **is** configured and any of these conditions is true:
|
||||
|
|
@ -272,7 +272,7 @@ Discord needs an **external, internet-facing** URL to correctly display this ima
|
|||
|
||||
Without any other configuration, the default URL is for the the MS logo:
|
||||
|
||||
<img src={require('/img/discord_presence.png').default} height="131"/>
|
||||
<img src={require('/img/discord_presence_ms_default.png').default} height="127"/>
|
||||
|
||||
This default image can be customized:
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
BIN
docsite/static/img/discord_presence_ms_default.png
Normal file
BIN
docsite/static/img/discord_presence_ms_default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
|
|
@ -19,8 +19,8 @@ import { isSuperAgentResponseError } from "../../errors/ErrorUtils.js";
|
|||
import { urlToMusicService } from "../ListenbrainzApiClient.js";
|
||||
import { fa } from "@faker-js/faker";
|
||||
|
||||
const ARTWORK_PLACEHOLDER = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/icon.png';
|
||||
const MB_ART = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/musicbrainz-logo-small.png';
|
||||
const ARTWORK_PLACEHOLDER = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/default-artwork.png';
|
||||
const MS_ART = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/icon.png';
|
||||
const API_GATEWAY_ENDPOINT = 'https://discord.com/api/gateway';
|
||||
|
||||
/**
|
||||
|
|
@ -432,7 +432,8 @@ export class DiscordWSClient extends AbstractApiClient {
|
|||
artwork = false
|
||||
} = this.config;
|
||||
const {
|
||||
artworkDefaultUrl = ARTWORK_PLACEHOLDER
|
||||
artworkDefaultUrl = ARTWORK_PLACEHOLDER,
|
||||
applicationId
|
||||
} = this.config;
|
||||
|
||||
let art = artworkDefaultUrl;
|
||||
|
|
@ -458,15 +459,14 @@ export class DiscordWSClient extends AbstractApiClient {
|
|||
if(usedUrl !== undefined) {
|
||||
activity.assets.large_image = usedUrl;
|
||||
}
|
||||
if(activity.assets.small_text !== undefined) {
|
||||
const smallArt = await this.getArtworkUrl(MB_ART);
|
||||
if(smallArt !== undefined) {
|
||||
}
|
||||
if(art !== MS_ART && applicationId !== undefined) {
|
||||
const smallArt = await this.getArtworkUrl(MS_ART);
|
||||
if(smallArt !== undefined) {
|
||||
activity.assets.small_image = smallArt;
|
||||
} else {
|
||||
delete activity.assets.small_text;
|
||||
delete activity.assets.small_url;
|
||||
}
|
||||
}
|
||||
activity.assets.small_text = 'Via Multi-Scrobbler'
|
||||
activity.assets.small_url = 'https://multi-scrobbler.app'
|
||||
}
|
||||
}
|
||||
|
||||
return activity;
|
||||
|
|
@ -738,7 +738,7 @@ export const playStateToActivityData = (data: SourceData, opts: { useArt?: boole
|
|||
if(url !== undefined) {
|
||||
const knownService = urlToMusicService(url);
|
||||
if(knownService !== undefined) {
|
||||
activity.assets.large_url = url;
|
||||
activity.details_url = url;
|
||||
|
||||
// when including buttons discord accepts the presence update but does not actually use it
|
||||
// I think buttons may now be limited to official RPC or restricted to preset actions via things like secrets or registering commands
|
||||
|
|
@ -752,11 +752,10 @@ export const playStateToActivityData = (data: SourceData, opts: { useArt?: boole
|
|||
}
|
||||
if(recording !== undefined) {
|
||||
const mb = `https://musicbrainz.org/recording/${recording}`;
|
||||
if(activity.assets.large_url === undefined) {
|
||||
activity.assets.large_url = mb;
|
||||
if(activity.details_url === undefined) {
|
||||
activity.details_url = mb;
|
||||
} else {
|
||||
activity.assets.small_url = mb;
|
||||
activity.assets.small_text = 'Open On Musicbrainz';
|
||||
activity.state_url = mb;
|
||||
}
|
||||
// buttons.push({
|
||||
// label: 'Open on Musicbrainz',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue