[GH-ISSUE #32] [new-feature-request] Adding rich presence buttons #1083

Open
opened 2026-05-23 01:58:16 +01:00 by JakeStanger · 9 comments
Owner

Originally created by @DestroyerAce on GitHub (Oct 28, 2022).
Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/32

It would be nice if there are rich presence buttons that shows link for what song you are playing on spotify or/and youtube

Originally created by @DestroyerAce on GitHub (Oct 28, 2022). Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/32 It would be nice if there are rich presence buttons that shows link for what song you are playing on spotify or/and youtube
Author
Owner

@JakeStanger commented on GitHub (Oct 28, 2022):

Happy to add this. MusicBrainz has info for Spotify/YouTube links so I can pull it from there. If it doesn't exist there though for a particular song, I think I'll have to fall back to not displaying them for now. The alternative would be to search and hope the result comes back correct, which would also require users to add API keys to their config.

<!-- gh-comment-id:1295243324 --> @JakeStanger commented on GitHub (Oct 28, 2022): Happy to add this. MusicBrainz has info for Spotify/YouTube links so I can pull it from there. If it doesn't exist there though for a particular song, I think I'll have to fall back to not displaying them for now. The alternative would be to search and hope the result comes back correct, which would also require users to add API keys to their config.
Author
Owner

@JakeStanger commented on GitHub (Nov 1, 2022):

So I've had a look into this, and there are two big issues I see:

  • None of the Discord RPC libraries have button support currently. It can be patched in, but it seems to work in a bit of a weird way so it's a bit of work.
  • More importantly, very few tracks in the MusicBrainz database have streaming links.

My concern is that it'd be quite a bit of work to add a feature that would be visible a fraction of the time.

The immediate alternative method I see is to directly search YouTube/Spotify using their APIs, but as stated that would require users to obtain their own API keys and add them to the config, which I'm reluctant to add as a requirement and I suspect most people won't bother with. It also adds quite a lot more complexity to the program in general.

If yourself or anybody else has any other ideas, I'm happy to look into them and see if we can add it that way, but I'm going to have to halt this otherwise.

<!-- gh-comment-id:1298966112 --> @JakeStanger commented on GitHub (Nov 1, 2022): So I've had a look into this, and there are two big issues I see: - None of the Discord RPC libraries have button support currently. It can be patched in, but it seems to work in a bit of a weird way so it's a bit of work. - More importantly, very few tracks in the MusicBrainz database have streaming links. My concern is that it'd be quite a bit of work to add a feature that would be visible a fraction of the time. The immediate alternative method I see is to directly search YouTube/Spotify using their APIs, but as stated that would require users to obtain their own API keys and add them to the config, which I'm reluctant to add as a requirement and I suspect most people won't bother with. It also adds quite a lot more complexity to the program in general. If yourself or anybody else has any other ideas, I'm happy to look into them and see if we can add it that way, but I'm going to have to halt this otherwise.
Author
Owner

@natto1784 commented on GitHub (Nov 12, 2022):

There is one such library but it does not have the best code unfortunately. I have added a button as an example in my fork here. If you decide to use it, I would also recommend using the musicbrainz_rs crate.

<!-- gh-comment-id:1312539098 --> @natto1784 commented on GitHub (Nov 12, 2022): There is one such library but it does not have the best code unfortunately. I have added a button as an example in my fork [here](https://github.com/natto1784/mpd-discord-rpc/tree/discord-rich-presence). If you decide to use it, I would also recommend using the [musicbrainz_rs](https://docs.rs/musicbrainz_rs/latest/musicbrainz_rs/) crate.
Author
Owner

@JakeStanger commented on GitHub (Nov 19, 2022):

Looks like I must have missed that library when I was looking. This solves problem 1 nicely, so we're one step closer. Thanks for finding that!

The reason I'm not using a MusicBrainz library currently is that I can't see much advantage. I only need to perform a handful of basic HTTP requests at the moment and it doesn't feel like enough to warrant another dependency. If the scope of MusicBrainz integration ever expands, I'll definitely migrate over.

<!-- gh-comment-id:1320980959 --> @JakeStanger commented on GitHub (Nov 19, 2022): Looks like I must have missed that library when I was looking. This solves problem 1 nicely, so we're one step closer. Thanks for finding that! The reason I'm not using a MusicBrainz library currently is that I can't see much advantage. I only need to perform a handful of basic HTTP requests at the moment and it doesn't feel like enough to warrant another dependency. If the scope of MusicBrainz integration ever expands, I'll definitely migrate over.
Author
Owner

@42willow commented on GitHub (Jun 14, 2025):

Another use case for this would be to have a link to your music account profile (e.g. lastfm) which could be configurable and reduces complexity.

<!-- gh-comment-id:2972241782 --> @42willow commented on GitHub (Jun 14, 2025): Another use case for this would be to have a link to your music account profile (e.g. lastfm) which could be configurable and reduces complexity.
Author
Owner

@ngoomie commented on GitHub (Mar 22, 2026):

Another use case for this would be to have a link to your music account profile (e.g. lastfm) which could be configurable and reduces complexity.

This is what I just came here to request, I'd quite like to have a link to my selfhosted scrobbler

<!-- gh-comment-id:4106895735 --> @ngoomie commented on GitHub (Mar 22, 2026): > Another use case for this would be to have a link to your music account profile (e.g. lastfm) which could be configurable and reduces complexity. This is what I just came here to request, I'd quite like to have a link to my selfhosted scrobbler
Author
Owner

@ReallyWeirdCat commented on GitHub (Mar 24, 2026):

Another use case for this would be to have a link to your music account profile (e.g. lastfm) which could be configurable and reduces complexity.

This is what I just came here to request, I'd quite like to have a link to my selfhosted scrobbler

You can now do this with config parameters button1_text, button1_link, button2_text, button2_link, for static links it should be enough. Though it's also possible to use the dynamic parameters, this is what I do:

[format]
button1_text = "Search on YouTube"
button1_link = "https://www.youtube.com/results?search_query=$artist - $title"
<!-- gh-comment-id:4120065026 --> @ReallyWeirdCat commented on GitHub (Mar 24, 2026): > > Another use case for this would be to have a link to your music account profile (e.g. lastfm) which could be configurable and reduces complexity. > > This is what I just came here to request, I'd quite like to have a link to my selfhosted scrobbler You can now do this with config parameters `button1_text`, `button1_link`, `button2_text`, `button2_link`, for static links it should be enough. Though it's also possible to use the dynamic parameters, this is what I do: ```toml [format] button1_text = "Search on YouTube" button1_link = "https://www.youtube.com/results?search_query=$artist - $title" ```
Author
Owner

@fxzzi commented on GitHub (May 17, 2026):

just me or are the buttons borken? i just saw these got added, and I tried to add them to my config below:

hosts = ["localhost:6600"]

[format]
button1_link = "https://www.youtube.com/results?search_query=$artist - $title"
button1_text = "Listen on YouTube"
details = "$title"
display_type = "state"
large_image = "notes"
large_text = "$album"
small_image = ""
small_text = ""
state = "$artist"
timestamp = "both"

and uhh, i'm getting this:

ERROR mpd_discord_rpc: ErrorEvent { code: Some(4000), message: Some("child \"activity\" fails because [child \"buttons\" fails because [\"buttons\" at position 0 fails because [child \"url\" fails because [\"url\" must be a valid uri]]]]") }
<!-- gh-comment-id:4471246282 --> @fxzzi commented on GitHub (May 17, 2026): just me or are the buttons borken? i just saw these got added, and I tried to add them to my config below: ```toml hosts = ["localhost:6600"] [format] button1_link = "https://www.youtube.com/results?search_query=$artist - $title" button1_text = "Listen on YouTube" details = "$title" display_type = "state" large_image = "notes" large_text = "$album" small_image = "" small_text = "" state = "$artist" timestamp = "both" ``` and uhh, i'm getting this: ``` ERROR mpd_discord_rpc: ErrorEvent { code: Some(4000), message: Some("child \"activity\" fails because [child \"buttons\" fails because [\"buttons\" at position 0 fails because [child \"url\" fails because [\"url\" must be a valid uri]]]]") } ```
Author
Owner

@ReallyWeirdCat commented on GitHub (May 19, 2026):

just me or are the buttons borken? i just saw these got added, and I tried to add them to my config below:

hosts = ["localhost:6600"]

[format]
button1_link = "https://www.youtube.com/results?search_query=$artist - $title"
button1_text = "Listen on YouTube"
details = "$title"
display_type = "state"
large_image = "notes"
large_text = "$album"
small_image = ""
small_text = ""
state = "$artist"
timestamp = "both"

and uhh, i'm getting this:

ERROR mpd_discord_rpc: ErrorEvent { code: Some(4000), message: Some("child \"activity\" fails because [child \"buttons\" fails because [\"buttons\" at position 0 fails because [child \"url\" fails because [\"url\" must be a valid uri]]]]") }

Strange, works for me on latest release. Tried this exact config, no errors. What were the $artist and $title? My suspicion is that they had some unacceptable special symbols

<!-- gh-comment-id:4485538576 --> @ReallyWeirdCat commented on GitHub (May 19, 2026): > just me or are the buttons borken? i just saw these got added, and I tried to add them to my config below: > > hosts = ["localhost:6600"] > > [format] > button1_link = "https://www.youtube.com/results?search_query=$artist - $title" > button1_text = "Listen on YouTube" > details = "$title" > display_type = "state" > large_image = "notes" > large_text = "$album" > small_image = "" > small_text = "" > state = "$artist" > timestamp = "both" > > and uhh, i'm getting this: > > ``` > ERROR mpd_discord_rpc: ErrorEvent { code: Some(4000), message: Some("child \"activity\" fails because [child \"buttons\" fails because [\"buttons\" at position 0 fails because [child \"url\" fails because [\"url\" must be a valid uri]]]]") } > ``` Strange, works for me on latest release. Tried this exact config, no errors. What were the $artist and $title? My suspicion is that they had some unacceptable special symbols
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/mpd-discord-rpc#1083
No description provided.