Hi guys,
New here Actually I'm not even a moodeaudio user - but I've been struggling with raspotify/librespot connection issues for ~2 years on 2 separate raspberry pi's and could never find the cause, let alone a workaround - but I came across something yesterday which seems (so far, fingers crossed) to have finally addressed it.
Symptoms experience (in past):
Connect from spotify, play music - music will randomly stop, mid-track. It could be after 10s, it could be after 10 tracks, it could be after an hour. But it WILL happen - generally within an hour. Sometimes the service is still running and I can still re-connect from Spotify and resume playing. Occasionally I'll need to send a quick service raspotify restart so the client can reconnect.
The logs, even verbose logging, display no indication of what is going on
I have more of these examples stored somewhere but here's what they generally look like:
Setup:
One is running OSMC and connected to USB speakers (I've had it ~1 year), the other is running Raspbian and connected to a TV using HDMI (~2 years). Both experience the same issue.
The workaround:
I came across an obscure post somewhere (which I've lost - I came across this looking for the original) which suggested running librespot manually in a terminal (rather than as a service). I decided to do so just to observe any additional errors that might not be getting logged... But so far my stream held steady the entire afternoon and I haven't experienced the issue.
So what I'm suggesting is disable the service and run librespot in a screen session instead. It's worth a shot.
I have the following simple script (remember to chmod +x it) to launch librespot:
If you want to automatically start a screen session and run a script at boot I would suggest adding the following to the bottom of /etc/rc.local:
PS: it's possible the "d" daemon mode in that line might be an issue; still untested (I use that in other service that stop crash).
New here Actually I'm not even a moodeaudio user - but I've been struggling with raspotify/librespot connection issues for ~2 years on 2 separate raspberry pi's and could never find the cause, let alone a workaround - but I came across something yesterday which seems (so far, fingers crossed) to have finally addressed it.
Symptoms experience (in past):
Connect from spotify, play music - music will randomly stop, mid-track. It could be after 10s, it could be after 10 tracks, it could be after an hour. But it WILL happen - generally within an hour. Sometimes the service is still running and I can still re-connect from Spotify and resume playing. Occasionally I'll need to send a quick service raspotify restart so the client can reconnect.
The logs, even verbose logging, display no indication of what is going on
I have more of these examples stored somewhere but here's what they generally look like:
Code:
Nov 20 10:27:42 officepi librespot[21836]: TRACE:librespot_audio::fetch: chunk 100 / 103 complete
Nov 20 10:27:42 officepi librespot[21836]: TRACE:librespot_audio::fetch: requesting chunk 101
Nov 20 10:27:43 officepi librespot[21836]: TRACE:librespot_audio::fetch: chunk 101 / 103 complete
Nov 20 10:27:43 officepi librespot[21836]: TRACE:librespot_audio::fetch: requesting chunk 102
Nov 20 10:27:43 officepi librespot[21836]: TRACE:librespot_audio::fetch: chunk 102 / 103 complete
Nov 20 10:27:43 officepi librespot[21836]: DEBUG:librespot_audio::fetch: File 96e6fe448652629359c13496af3121320d846eaa complete
[Crash happens here - the above is completely normal and happens for every track - I then restart the service]
Nov 20 10:28:01 officepi systemd[1]: Stopping Raspotify...
Nov 20 10:28:01 officepi systemd[1]: Stopped Raspotify.
Nov 20 10:28:01 officepi systemd[1]: Starting Raspotify...
Setup:
One is running OSMC and connected to USB speakers (I've had it ~1 year), the other is running Raspbian and connected to a TV using HDMI (~2 years). Both experience the same issue.
The workaround:
I came across an obscure post somewhere (which I've lost - I came across this looking for the original) which suggested running librespot manually in a terminal (rather than as a service). I decided to do so just to observe any additional errors that might not be getting logged... But so far my stream held steady the entire afternoon and I haven't experienced the issue.
So what I'm suggesting is disable the service and run librespot in a screen session instead. It's worth a shot.
I have the following simple script (remember to chmod +x it) to launch librespot:
Code:
pi@officepi:~ $ cat manlibrespot.sh
#!/bin/bash
/usr/bin/librespot --name stablepi --bitrate 320 --initial-volume 15 --enable-volume-normalisation --linear-volume --disable-audio-cache --verbose
#OPTIONAL ARGS:--backend alsa --device plughw:0 --onevent /var/local/www/commandw/spotevent.sh --username [USERNAME] --password [PASSWORD]
If you want to automatically start a screen session and run a script at boot I would suggest adding the following to the bottom of /etc/rc.local:
Code:
su pi -c '/usr/bin/screen -dmS manlibrespot /home/pi/manlibrespot.sh'