LordBoos / discord_game

Home Assistant custom component to get online and game status of Discord users
MIT License
56 stars 7 forks source link

make static image format configurable, add support for animated avatars #12

Closed niklaswa closed 4 years ago

niklaswa commented 4 years ago

closes #9

LordBoos commented 4 years ago

Hello and thank you. Have you considered that PNG images are much bigger than WEBP? Eg. my own discord avatar has 150 KB in WEBP format and 1.8 MB in PNG format. That might be a little problematic for mobile data plans. I think that a configuration option to change formats would be better approach.

niklaswa commented 4 years ago

That's true. Maybe that would be better. In general, the avatar url should use this function, so GIF avatars are supported too. But I would have to deal more with the architecture of Python applications to understand exactly where to do what.

niklaswa commented 4 years ago

I implemented it. 😄

LordBoos commented 4 years ago

Good job. Have you tested it? I had some problems with serialization while passing url to watcher directly like you do. Or does avatar_url_as method escapes the URL somehow?

niklaswa commented 4 years ago

I tested it with users with default avatars, normal avatars and animated avatars in Chrome and Safari and had no problems.

LordBoos commented 4 years ago

Yea I just tested it myself and got no issues. Thank you for your contribution. 🙂