plietar / librespot

Open Source Spotify client library
MIT License
1.13k stars 187 forks source link

Added `fetch_audio_file` to Player #278

Closed paulo-raca closed 5 years ago

paulo-raca commented 6 years ago

On my spotify-based application, I don't want just want to just playback the audio stream, but also to fetch it for playing back later (offline).

In order to do so, I have split the flow of load_track in half:

The part responsible for fetching and decrypting the audio file is now on get_track_file, and is shared with the implementation of fetch_audio_file The part that skips the first few bytes of the file (Ogg headers?) and creates a decoder continues implemented within load_track.

paulo-raca commented 6 years ago

Interestingly, the code currently works perfectly for Ogg Vorbis files, but not at all for other formats.

OTHER2 is fetched successfully, but appears to be garbage (Maybe it should do decryption differently?)

All other formats panic with AudioKeyError. Has there been any investigation on the decryption of those files? (I'm mainly interested in AAC)

sashahilton00 commented 5 years ago

@paulo-raca the main repo is now located at https://github.com/librespot-org/librespot, you might want to pitch in there if you want to add features.

paulo-raca commented 5 years ago

Ok, thanks