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

Artwork/cover showing in discord(?) + title format #4

Open
claire-rouge opened this issue Mar 8, 2018 · 4 comments
Open

Artwork/cover showing in discord(?) + title format #4

claire-rouge opened this issue Mar 8, 2018 · 4 comments

Comments

@claire-rouge
Copy link

is it possible to make so the foo_drpc component show the artwork/cover? (if the file ur playing have it)
instead of foobar2000 logo in discord?

maybe a option to turn that off and on for people that wants it in components preference.
(idunno if u want to do it, sound like alot of work to do. but would be a nice option to have)

if u dont want to do the thing above, is it possible to make so we can change how the songs are being showed atleast? (i dont like how it shows artist-title, i like it like "title" by artist)
if we could add our own title format script it would be nice. since i like using this:

$if($and(%artist%,%title%), "%title%" By %artist% )
$if($and(%title%,$not(%artist%)), %title% )

(and some may like to use their own)

@ultrasn0w
Copy link
Owner

ultrasn0w commented Mar 8, 2018

Hey there,
First of all, thanks for telling me your wishes and ideas.

Regarding artwork and covers, I unfortunately have to tell you that this is not quite possible. :(
The images shown inside the rich presence work kind of like this:
Each "app" using the Discord Rich Presence has a unique registered ID it sends together with the Rich Presence message packets.
On Discords end, this ID is linked with an "Rich Presence app" that I registered there, also the name and images this app can use inside of the Rich Presence are stored there.
So, inside of the Rich Presence messages, each app sends the name of one of those images (or more for the small icon and background) to Discord.

If my plugin should be able to show artwork or a cover, I would need to upload them to the Discord application registration as assets for the Presence App to use.
AFAIK there is a limit on how many assets you can upload there and automated upload for them is not available yet (still Ignoring the fact, that artwork from every plugin user would need to be uploaded).

For the second thing, I havent figured out yet how to register a configuration/settings page inside of the foobar2000 preferences window. I could however try to store some sort of config inside of a file that could be edited. I'll gonna try to implement that!

@claire-rouge
Copy link
Author

  1. oh, thank you for quick answer, I see. Well it cant be helped then ^^

  2. ye that would be cool if you manage to implement that :)

Thank you again for answering so fast, so far i love this component for Discord Rich Presence.
keep up the good work 👍

@ayancey
Copy link

ayancey commented Aug 15, 2018

I've been thinking about this too. Each user would need to create their own Discord "app" and set the ID accordingly, but you could probably easily automate the act of uploading a picture with an HTTP library. I'm not a C++ guy, but I want to try and get a proof of concept working of this.

@ayancey
Copy link

ayancey commented Aug 15, 2018

def change_album_art(f_name):
    with open(f_name, "rb") as f:
        album_cover_base64 = base64.b64encode(f.read())
    requests.post(
        "https://discordapp.com/api/oauth2/applications/YOUR APP ID/assets",
        headers={"Authorization": "YOUR AUTH HEADER HERE"},
        json={
            "name": "album",
            "image": "data:image/jpeg;base64,{}".format(
                album_cover_base64.decode("ascii")
            ),
            "type": "1",
        },
    )

This above method will upload a JPG to the app assets list, given the users app id and authorization header. Unfortunately, I couldn't get the proof of concept to work that uploads album art and sets the activity on the fly. I think it's an issue with caching or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants