Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Problem: Spotify connect keeps dropping
#39
Hi guys, cross-posting the latest "workaround" that I'm trying - keen to see if more people get positive results from it. Quoting here but original post over here: http://moodeaudio.org/forum/showthread.p...7#pid14897

(12-03-2019, 11:37 PM)oboote Wrote: Hi guys,

New here  Smile 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  Huh
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'

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).

I've only been running this for half a day so I may come back tonight with my tail between my legs but so far so good.

Side-note: I've been struggling with this for years and it gave me a warm fuzzy feeling to see someone here quote something I shared in a random github convo about the issue  Blush
Reply


Messages In This Thread
Spotify connect keeps dropping - by PhotonHerder - 11-24-2018, 10:12 PM
RE: Spotify connect keeps dropping - by jonners - 11-25-2018, 09:40 PM
RE: Spotify connect keeps dropping - by zaqqq - 11-25-2018, 01:13 PM
RE: Spotify connect keeps dropping - by zaqqq - 11-25-2018, 02:07 PM
RE: Spotify connect keeps dropping - by ksone - 11-28-2018, 08:42 AM
RE: Spotify connect keeps dropping - by ksone - 12-05-2018, 09:28 PM
RE: Spotify connect keeps dropping - by ksone - 12-06-2018, 07:55 AM
RE: Spotify connect keeps dropping - by ksone - 12-06-2018, 01:43 PM
RE: Spotify connect keeps dropping - by adixor - 03-22-2019, 08:11 PM
RE: Spotify connect keeps dropping - by Edward - 03-31-2019, 06:25 PM
RE: Spotify connect keeps dropping - by ksone - 04-01-2019, 12:10 PM
RE: Spotify connect keeps dropping - by deafnut - 04-13-2019, 08:55 PM
RE: Spotify connect keeps dropping - by deafnut - 04-17-2019, 08:49 PM
RE: Spotify connect keeps dropping - by deafnut - 04-19-2019, 12:01 AM
RE: Spotify connect keeps dropping - by ksone - 04-22-2019, 08:32 AM
RE: Spotify connect keeps dropping - by oboote - 12-03-2019, 11:47 PM
RE: Spotify connect keeps dropping - by oboote - 12-06-2019, 03:04 AM

Forum Jump: