plietar / librespot

Open Source Spotify client library
MIT License
1.14k stars 185 forks source link

Add --disable-audio-cache startup parameter #204

Closed michaelherger closed 7 years ago

michaelherger commented 7 years ago

Disable caching of downloaded audio files at runtime. Comes in handy when running librespot on a small device with SD card or other small storage.

awiouy commented 7 years ago

Thanks! I am using this now, and I hope it will make it upstream.

sashahilton00 commented 7 years ago

Using this now as well, +1 for upstream :)

plietar commented 7 years ago

Thanks @michaelherger

Could you move the logic to the Cache::save_file function ?

mherger commented 7 years ago

I put it in the player code as I don't want to disable all (potential) file caching. It's really about caching the audio data. There could be other code using the cache. (FWICT there's none right now, is there?)

plietar commented 7 years ago

Yes save_file is only for audio data, so it is fine to move it there

michaelherger commented 7 years ago

Ok, will update my change.

(argh... at some point I have to have a better strategy to separate my pro from my personal GitHub account...)

michaelherger commented 7 years ago

Hmm... credentials is using the same cache object all over the place. Not initializing cache for files only, but use it for credentials looks like a much more complicated change, dealing with multiple cache instances etc. Am I totally wrong?

michaelherger commented 7 years ago

BTW: is cache/default_cache even used anywhere?

plietar commented 7 years ago

My point was to make use_audio_cache a field of Cache rather than Config, and move the if use_audio_cache test into the save_file method.

default_cache is just some leftover from a previous implementation, I forgot to delete it. You can do it if you want

michaelherger commented 7 years ago

Take 2.

plietar commented 7 years ago

Awesome thanks !