music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.21k stars 44 forks source link

Poor Soundcloud Artwork Quality #2467

Open danielkleinert opened 2 weeks ago

danielkleinert commented 2 weeks ago

What version of Music Assistant has the issue?

2.0.6

What version of the Home Assistant Integration have you got installed?

2024.5.1

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

Currently the app displays exceptionally blurry artwork with a 100x100px resolution. Images on the Soundcloud site look way cleaner. We should have bigger Images in Music Assistent as well.

eg. https://i1.sndcdn.com/artworks-000166304222-fjxebe-large.jpg (returned from the Soundcloud API, displayed in MA) https://i1.sndcdn.com/artworks-000166304222-fjxebe-t500x500.jpg (displayed on Soundcloud)

A quick look in the network requests on Soundcloud.com shows that the URL for the bigger image is not returned by the api but rather constructed with JS client code in the browser.

availableSizes: [[20, "t20x20"], [50, "t50x50"], [120, "t120x120"], [200, "t200x200"], [500, "t500x500"]],
availableVisualsSizes: [[1240, "t1240x260"], [2480, "t2480x520"]],
imageUrlRegex: /^.*\/(\w+)-([-a-zA-Z0-9]+)-([a-z0-9]+)\.(jpg|png|gif).*$/i,

How to reproduce

play Soundcloud track, look at artwork, be disgusted

Music Providers

Soundcloud

Player Providers

Upnp

Full log output

No response

Additional information

No response

What version of Home Assistant Core are your running

2024.6.2

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

ODROID

MelHarbour commented 3 days ago

The documentation for that call seems to have got lost a few years back, but a WaybackMachine capture of what it says is:

JPEG, PNG and GIF are accepted when uploading and will be encoded to multiple JPEGs in these formats:

t500x500: 500×500 crop: 400×400 t300x300: 300×300 large: 100×100 (default) t67x67: 67×67 (only on artworks) badge: 47×47 small: 32×32 tiny: 20×20 (on artworks) tiny: 18×18 (on avatars) mini: 16×16 The URL is pointing to the format large by default. If you want to use a different format you have to replace large with the specific format name in the image URL:

For example:

http://i1.sndcdn.com/avatars-000000011308-xq0whu-large.jpg?b17c165

to

http://i1.sndcdn.com/avatars-000000011308-xq0whu-crop.jpg?b17c165

I'll get a patch in for that after my current PR gets merged (don't want to have too many things on the go at the same time).