Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show album art instead of player icon #19

Open
9p4 opened this issue Jan 28, 2021 · 24 comments
Open

Show album art instead of player icon #19

9p4 opened this issue Jan 28, 2021 · 24 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@9p4
Copy link

9p4 commented Jan 28, 2021

Instead of showing the player icon, show the embedded album art instead of the default icon. Looks like we can use the Metadata property and get the album art uri and embed that.

@FichteFoll
Copy link
Owner

FichteFoll commented Jan 29, 2021

It's not possible to use arbitrary icons with the Rich Presence API. All icons must be uploaded for the registered app first and can then be referenced by name.

It may be possible for everyone to maintain a custom app and then have discordrp-mpris upload album art assets there, but I don't know how fast the images are updated (the website takes minutes to list newly added icons). Would also be quite a bit of work, although the feature is nice.

@FichteFoll FichteFoll added the enhancement New feature or request label Jan 29, 2021
@jojo2357
Copy link

jojo2357 commented Apr 4, 2022

Discord has recently added support for URL's as a rich presence asset, although I am not sure how many libraries are supporting that right now.

I am the maintainer of MDRP, and I am in the process of using the ITunes api to get a url that refers to the art for a specific album, searchable by artist, album, and song. I unfortunately have to use an alpha build of the c# library, so this is probably not supported in python yet

@FichteFoll
Copy link
Owner

That sounds interesting. Can you point me to some documentation on this new feature or alternatively the code of this c# library? I fear it might be using a different IPC interface than what I am currently using since they did add another API after I wrote this.

Note that it's not a high priority for me at the moment.

@BobbyWibowo
Copy link

BobbyWibowo commented May 17, 2022

It appears to be possible to use remote URLs of any file hosts as-is into both large_image and small_image fields
It is the solution currently implemented in phineas05 / discord-rich-presence-plex

A bit more details over here TheQwertiest/foo_discord_rich#6 (comment)

@BobbyWibowo
Copy link

BobbyWibowo commented May 17, 2022

I ended up implementing this on my personal-use fork (BobbyWibowo@907949b ... BobbyWibowo@f88a7b5)

Mostly by "stealing" our existing Config class and some bits and pieces from phineas05/discord-rich-presence-plex
However I'm not going to make a PR because I don't trust my current Python experience for public usage

Linking them for references, and to hopefully kickstart FichteFoll early to implement it themselves, lmao

I also found it troublesome to make it auto-create an empty JSON cache file, so I did not
Users must create an empty valid JSON file named cache.json in their local discordrp-mpris config directory to even start using it


YouTube videos via plasma-browser-integration (as-is due to using YouTube thumb url directly)
image

Strawberry Music Player (auto-upload local album cover to imgur)
image


Also I just noticed the actual media players became unrecognizable due to no icons or texts, lmao, but I'm not gonna bother with that (I forgot player name is available via hover text on large image)

@SergSel2006
Copy link

SergSel2006 commented Oct 15, 2022

Yeah? this addition seems to be good. There is a discord documentation available on this idea. The link from upper comment don't work. So, please, can you make it?
Also, there's metadata type which has base32 encoded image as I remember.

@SergSel2006
Copy link

I've just started making fork of this masterpiece, but with album arts. As I see, you can just pass http URLs and it will show the album art from metadata (I've just used ctrl+C ctrl+V and changed one condition with resulting activity for a bit). I'm now working on any other URLs because there's commonly rfc2397 URL, which discord (for some reason) can't use. Though, we can easily get image from there and use it.

@FichteFoll
Copy link
Owner

FichteFoll commented Nov 28, 2022

Since you seem to have made some investigations already, which application uses which scheme?

For data: URLs, much like file:, I believe we would need to upload the images somewhere so that discord can find/reference them via http, which isn't exactly a small overhead if we also want to make that configurable. Otherwise I would simply pick a reliable temporary fire-and-forget host like 0x0.st. This upload behavior would definitely need to be disabled by default, however.

@SergSel2006
Copy link

SergSel2006 commented Dec 8, 2022

Getting image isn't a problem because urllib from python standard library does it. Only problem is to use it with discord. We need to send them to some host (user-defined?), get https: link and done. Seems easy

@SergSel2006
Copy link

I've just made a pull request #32 with solution to this issue

@FichteFoll FichteFoll added this to the 0.4.0 milestone May 9, 2023
FichteFoll added a commit that referenced this issue May 9, 2023
Partially implements #19 for players that provide a world-accessible URL
using HTTP(S). Automatic image upload for local files will be
implemented later.
@FichteFoll
Copy link
Owner

On the next branch, I have implemented the first version of this by honoring the mpris:artUrl metadata field and using it when it starts with http:// or https://, which I tested with mpv and the youtube-dl integration. FireFox shows a local path in this field, so unfortunately that doesn't work just yet. This was inspired by 47cbc89.

I'll see when I get around to thinking more about how I want the custom file upload to be structured & configured to allow for sufficient flexibility.

@mariuszste
Copy link

I'll see when I get around to thinking more about how I want the custom file upload to be structured & configured to allow for sufficient flexibility.

Maybe s3 with a custom endpoint? That would be the most universal option, most hosting providers provide an s3 compatible storage for penies + can easily be self hosted with something like minio. A public image upload site is also fine as a default "may or might not work" alternative for people that can't/don't want to use s3.

Another funny (free) way would be to have a discord bot upload them on some random channel and then just feed the discord cdn url back to discord 🤣 but that is a bit overkill imo

@SergSel2006
Copy link

I'll see when I get around to thinking more about how I want the custom file upload to be structured & configured to allow for sufficient flexibility.

Maybe s3 with a custom endpoint? That would be the most universal option, most hosting providers provide an s3 compatible storage for penies + can easily be self hosted with something like minio. A public image upload site is also fine as a default "may or might not work" alternative for people that can't/don't want to use s3.

Another funny (free) way would be to have a discord bot upload them on some random channel and then just feed the discord cdn url back to discord rofl but that is a bit overkill imo

I've done this in my fork already, but it's just too simple to be there. It's just for an example and a start point to go

@9p4
Copy link
Author

9p4 commented May 25, 2023

Perhaps musicbrainz integration? Pull metadata of the song to automatically find a URL to the album art?

@HxxThSwggr
Copy link

There is a MusicBee discord plugin which has working album art.

I thought it might help y'all.

@FichteFoll
Copy link
Owner

FichteFoll commented Jun 19, 2023

Is anyone here actually interested in being able to choose the image hosting service or would you be fine with anything as long as it works? Not having to implement imgur uploading for example and only considering very simple pomf-like HTTP POST upload services would make the first iteration a lot easier to implement.

Well, to be honest, I would do those implementations first anyway because they are so simple. Other upload services might then get added later on an on-demand basis.

@mariuszste
Copy link

Is anyone here actually interested in being able to choose the image hosting service

not having to rely on some random host that might break/rate limit you at any monet is definitely appreciated. Get the initial implementation on whatever is the most comfortable and just design it in a way where hosting providers can easily be swapped out.

@SergSel2006
Copy link

SergSel2006 commented Jun 19, 2023

Is anyone here actually interested in being able to choose the image hosting service

not having to rely on some random host that might break/rate limit you at any monet is definitely appreciated. Get the initial implementation on whatever is the most comfortable and just design it in a way where hosting providers can easily be swapped out.

Bro my fork using host that is able to send http link after POST.
EDIT: You can change it in config. And use host per player.

@SergSel2006
Copy link

SergSel2006 commented Mar 23, 2024

I think that I have good solution - Host simple HTTP server on the users' computers.
Start HTTP host when needed to send albumart to discord, stop it when it is no longer needed or restart when albumart changed (for the sake of little more security?).
HTTP should be fine for discord, but some random IP can be problem for discord. I will investigate it later.
Though, there might be some things that will stop us from using this approach - like NAT. Router Firewall can be bypassed with UPnP though

@9p4
Copy link
Author

9p4 commented Mar 23, 2024

NAT/firewall would also be a problem, unless if Discord proxies the album art.

@mariuszste
Copy link

NAT/firewall would also be a problem, unless if Discord proxies the album art.

discord proxies all images (and other embeds) on its platform.

@9p4
Copy link
Author

9p4 commented Mar 26, 2024

It proxies it from "outside"—ie some Discord server somewhere will grab the URL and proxy from there on. The client itself does not proxy the information.

@FichteFoll
Copy link
Owner

Hosting an HTTP server yourself is an interesting idea at first, but as already mentioned not applicable because of NAT/firewall. Instead of your own client locally resolving the URL (where we could even use a localhost url), it is highly likely that either discord's cdn servers or your peers' clients are fetching the image from outside instead.

If this somehow proves to be wrong then that would simplify the implementation a lot indeed, but I highly doubt it.

@FichteFoll FichteFoll self-assigned this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants