11-07-2018, 04:48 AM
(11-07-2018, 12:57 AM)TheOldPresbyope Wrote:(11-06-2018, 08:51 PM)abigor Wrote: Hi. During long listening spotify the cache size (/var/local/www/spotify_cache/files) increases and takes up all the free space on the memory card, because of this, the system stops working stably, is there any solution to limit the cache size ? I try to clean this folder on my own through cron, it looks like it works.
P.S. Moode 4.3 (with native Spotify support)
@abigor
Looking through the issues log on the librespot github repo, I see that this same problem was addressed by the maintainer last year with the addition of a new run-time option "--disable-audio-cache". It isn't clear, at least to me, what side effects this option may have so we'll likely have to test it before adding it in moOde.
@abigor
I make the change to playerlib.php and have been listening to Spotify tracks for the past three hours. So far it seems to be working for me. I can't say this is an exhaustive test but it is at least a proof of concept. With the change and a reboot there is no caching of files to /var/local/www/spotify_cache/files directory. I cleared it once and it remains empty.
You apparently listen to Spotify a lot more than I do so how about testing this change too to see if I've overlooked a side effect? Since you have been mucking with cron I'm confident you can deal with the edit involved.
In /var/www/inc/playerlib.php, there's a long string-concatenation statement beginning at line 1752 (in moOde r43)
Code:
$cmd = 'librespot' .
' --name "' . $_SESSION['spotifyname'] . '"' .
' --bitrate ' . $cfg_spotify['bitrate'] .
' --initial-volume ' . $cfg_spotify['initial_volume'] .
$linear_volume .
$volume_normalization .
' --cache /var/local/www/spotify_cache --backend alsa --device "' . $device . '"' .
' --onevent /var/local/www/commandw/spotevent.sh' .
' > /dev/null 2>&1 &';
Insert a new line "' --disable-audio-cache' ." so the statement reads something like
Code:
$cmd = 'librespot' .
' --name "' . $_SESSION['spotifyname'] . '"' .
' --bitrate ' . $cfg_spotify['bitrate'] .
' --initial-volume ' . $cfg_spotify['initial_volume'] .
$linear_volume .
$volume_normalization .
' --disable-audio-cache' .
' --cache /var/local/www/spotify_cache --backend alsa --device "' . $device . '"' .
' --onevent /var/local/www/commandw/spotevent.sh' .
' > /dev/null 2>&1 &';
and reboot (executing "sudo /home/pi/srestart.sh" might be enough).
Listen to the music.
Regards,
Kent