JasonPuglisi / descent

Elegant now playing display for Last.fm showing song metadata and local weather.
https://descent.live
MIT License
124 stars 21 forks source link

Use Spotify cover art #3

Closed craftbyte closed 8 years ago

craftbyte commented 8 years ago

Spotify has a bigger cover art database and it's available in their API. Maybe make a toggle that would allow people to use the spotify database and fallback to last.fm. Docs: https://developer.spotify.com/web-api/search-item/ Example: https://api.spotify.com/v1/tracks/1MDoll6jK4rrk2BcFRP5i7

JasonPuglisi commented 8 years ago

I'll consider this. I've tried MusicBrainz and Discogs a few times, but wasn't completely satisfied.

JasonPuglisi commented 8 years ago

I'm happy with the results of this. The Spotify API was really easy to integrate, and as a heavy Spotify user, I wonder why I didn't think of this sooner :)

At the moment, Spotify is used for any covers that aren't found on Last.fm.

JasonPuglisi commented 8 years ago

Oh and one thing to keep in mind is Spotify's rate limiting, which they mention but don't go into detail about. Right now, the app doesn't authenticate or use credentials of any kind, which Spotify claims will put it into the highest rate limiting category. This may turn out to be a problem since all requests will be coming from the one server IP address due to image proxying. The proxying is necessary for color detection used in the text.

Right now, I'm not detecting rejected requests, and they should just act as if no image existed in the first place.

craftbyte commented 8 years ago

If that happens, maybe just use OAuth to have people login to Spotify and save the token, since you proxy the images, you can just link the last.fm username to a spotify account.

JasonPuglisi commented 8 years ago

With the latest commit, Spotify cover art is used exclusively, and it's no longer proxied by the server. Rate limiting shouldn't be an issue as clients are fetching the images directly. I can add the Last.fm images back in the future if this doesn't seem suitable, but we'll try it out for a while.

JasonPuglisi commented 8 years ago

With 32147217d9f7fbd653f87627e435a3699e80f0f4, this is back to the previous behavior with Last.fm cover image and Spotify as fallback. I wasn't completely satisfied with just Spotify, but the good news is that the server only proxies images now if they're from Last.fm (because it needs to in order for ColorThief to work).