Hexxeh / spotify-websocket-api

Spotify Websocket API is a fully open source Spotify library based on the WebSocket API used in the Spotify Web beta
395 stars 67 forks source link

Artwork URL retrieval? #13

Closed TooTallNate closed 11 years ago

TooTallNate commented 11 years ago

Hey @Hexxeh, just wanted to say a big Thank You! for this library. It's awesome :) And I've been diligently porting it to Node.js, and I'll be sure to show you that when it's ready :)

So my question is, have you figured out yet how to resole "file_id"s into (HTTP or otherwise) URIs? I'm trying to get album art for an album and can't figure out what to make of the Image metadata type.

For example, when looking up the metadata of an "album" type, I see the "cover" field:

  cover: 
   [ { fileId: <SlowBuffer 81 06 0a 6f 04 84 8d ad e7 ec 14 ee 72 27 2f 6c a1 e9 ff 5b>,
       size: 'DEFAULT',
       width: 300,
       height: 300 },
     { fileId: <SlowBuffer cf 5a 0b 50 9b 35 66 25 4a db f8 1e d6 9e f8 f1 29 cb 0e 0b>,
       size: 'SMALL',
       width: 64,
       height: 64 },
     { fileId: <SlowBuffer 13 51 85 85 82 75 a8 d1 91 d5 b5 7a 75 54 16 df 23 85 88 66>,
       size: 'LARGE',
       width: 640,
       height: 640 } ],

Which gives me dimensions and an ID, but now I don't know how to make that into real image data. Any thoughts?

Cheers! And great work again on the lib!

TooTallNate commented 11 years ago

Getting warmer... https://gist.github.com/4463921#file-spotify-web-client-js-L9278-L9284

Hexxeh commented 11 years ago

Check this function here, it builds the URLs from the file IDs: https://github.com/Hexxeh/spotify-websocket-api/blob/master/spotify_web/friendly.py#L515

TooTallNate commented 11 years ago

Excellent. Thanks a lot man!