Spotify Connect failures on Moode 4.4 - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: Spotify Connect failures on Moode 4.4 (/showthread.php?tid=765) |
RE: Spotify Connect failures on Moode 4.4 - TheOldPresbyope - 12-18-2018 It looks like we are in violent agreement here. Something is causing librespot to stop. We don't know what it is. The librespot issues log shows this is happening to others who aren't moOde users ("crash" is the same as "unexpectedly stops"). A possible cause of some of the stoppages has been suggested: an interruption in communications which disrupts the session with the Spotify server. The librespot developers have acknowledged there are problems with connect and reconnection. You find that on your system an invocation of librespot with credentials from the CLI solves your problem. At this point, we need data to give to the librespot developers. Since I don't suffer these stoppages, I can't provide it. Someone who does suffer the stoppages needs to follow Tim's suggestion to capture the librespot log. What follows are several excerpts from my log with a fresh install of moOde r4.4. 1. Enable Spotify renderer in moOde. Then start Spotify app on an Android Nexus 9 tablet. [I have replaced instances of my 25-char Spotify username with strings of "#". It must have been obtained from credentials in my Spotify app since no credentials have been entered into moOde.] Code: pi@moode:~ $ tail -f librespot.txt What this shows early on is that my Spotify app has passed my credentials (or at least my Spotify username) to librespot and the Spotify server has authenticated me. The rest is all niff-naff associated with making a track selection, fetching it, changing volume, and starting to play the track. The log continues with these sorts of messages for as long as I have the Spotify renderer on and I'm playing tracks. 2. Turn off the Spotify app on my tablet and turn off the Spotify renderer in moOde. 3. Turn on the Spotify renderer in moOde. Since this reinvokes the librespot startup it starts the logfile afresh. Later, start the Spotify app on my tablet again. Code: pi@moode:~ $ cat librespot.txt What this shows early on is that librespot must have cached my credentials or else some sort of session cookie since it was able to reauthenticate without getting credentials from the Spotify app. Turning on the Spotify app merely triggered more kMessageTypeNotify's. The behavior shown in 1. and 3. make it hard for me to understand why restarting the Spotify renderer from within moOde isn't sufficient for recovery of the service. Something else must be happening at times. So what do folks see in their logs when their Spotify service is lost? Regards, Kent PS - I don't know the first thing about Rust so I can't read through the librespot codebase even if I wanted to. RE: Spotify Connect failures on Moode 4.4 - Tim Curtis - 12-18-2018 Refer to post #5 http://moodeaudio.org/forum/showthread.php?tid=765&pid=6234#pid6234 for the procedure to enable librespot debug logging that is shown in Kent's post. Until we can get log output for failure cases that can be submitted to the librespot dev's, nothing much is going to happen. -Tim RE: Spotify Connect failures on Moode 4.4 - andyc - 01-04-2019 My first post so apologies if the formatting isn't right. I’ve also been having some issues with spotify connect via moode and thought I would post my findings here in case it helps anyone. Spotify connect was all working fine for a while (about a week), but then it stop working. By checking the processes running I managed to determine that librespot started and then pretty much stoped straight away. This was consistent behaviour. I then enabled the debug in the playerlib.php as suggested by Tim, and got the following output. Code: INFO:librespot_core::session: Connecting to AP "gew1-accesspoint-b-kvtg.ap.spotify.com:4070" I have a premium account so thats not the issue. From the moode log I saw the command that was being run was Code: 20190104 194642 worker: (librespot --name "PiSpotify3" --bitrate 320 --initial-volume 0 --cache /var/local/www/spotify_cache --disable-audio-c I then ran this command from the shell direct and go the same error. I had previously run librespot with minimal parameters from the shell OK, so I thought the issue might be the parameters. I started removing the parameters one by one (starting with the last). Eventually I got to Code: librespot --name "PiSpotify3" --bitrate 320 --initial-volume 0 which was the first one that ran OK. So my thought was that the issue was with the --cache parameter. I then went back to the code in playerlib.php and removed the —cache parameter. rebooted. the spotify now works fine :-) I have a theory. I did change my spotify account soon before I started using moose with spotify connect. My old account was not premium, but my new account is premium. I wonder if I connect with an old device (phone) and it had the old account details, and somehow the cache was using the old account. This might be similar to users that had a similar issue and found that running librespot direct from the shell with the user name and password sorted their problem. This is just a theory though. I have not gone back and try to prove it. Andy S Y S T E M P A R A M E T E R S Date and time = 2019-01-04 19:56:01 System uptime = up 9 minutes Timezone = Europe/London moOde = Release 4.4 2018-12-09 HDWR REV = Pi-1B+ 512MB A U D I O P A R A M E T E R S Audio device = HiFiBerry DAC+ Pro Interface = I2S Hdwr volume = Controller detected Mixer name = Digital Output stream = S16_LE / 44100 ALSA version = 1.1.3-5+rpi3 SoX version = 0.1.2-2 RE: Spotify Connect failures on Moode 4.4 - Tim Curtis - 01-04-2019 Hi Andy, Good analysis :-) If you still have the original cache intact, try the following: 1. If u modified the launch params in playerlib.php then revert to original launch params and reboot 2. Save the credentials file Code: sudo mv /var/local/www/spotify_cache/files/credentials.json ./ 3. Turn on librespot from moOde UI to launch it If it launches ok then i might have to add a "Clear cache" option. -Tim RE: Spotify Connect failures on Moode 4.4 - TheOldPresbyope - 01-06-2019 @PeteT Good stuff. If you look at the librespot repo (https://github.com/librespot-org/librespot) you'll see this same high-level error message ("ERROR:librespot_core:ession: Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }") shows up in a number of the issues. I'm not good enough at Rust tracebacks to figure out if your issue is identical to one of the ones already posted. It wouldn't hurt to post yours. Several things have been changed in the code base to try to ameliorate one or another aspect of the problem but it appears not completely solved. See in particular issue #134 which is their placekeeper for the discussion. Some of the discussion in the various issues seem to implicate hiccups in Internet-connectivity; some not. Since the most recent code change which might be relevant is dated November 18, 2018, which is two months newer than the version of the librespot repo used in moOde r4.4, you could try pulling and building the latest version. This may or may not resolve your problem. Please let the moOde community know either way. Regards, Kent PS - don't forget to include the version of moOde you're working with when you post a bug report. RE: Spotify Connect failures on Moode 4.4 - Tim Curtis - 01-07-2019 moOde uses the a4e0f58 librespot commit dated August 17 2018. (there are no releases yet) https://github.com/librespot-org/librespot/commit/a4e0f582a8c705b05c8abba58d9e9c1c06ad532d This commit seems to be pretty robust but we could go with the latest ??? -Tim RE: Spotify Connect failures on Moode 4.4 - TheOldPresbyope - 01-07-2019 (01-07-2019, 05:19 AM)Tim Curtis Wrote: moOde uses the a4e0f58 librespot commit dated August 17 2018. (there are no releases yet) Yeah, we could, but I'd be happier if I could repro the problem so I could test that the November commit solves it. [added in edit] I suppose I could build the current master and test that it works as well as a4e0f58 does for me. Regards, Kent RE: Spotify Connect failures on Moode 4.4 - sjoerdju - 01-07-2019 Hi there all! I've been using librespot for a long time, used to compile it myself and run it as a service. It never was very stable in my opinion, but a quick reset of the service worked and sometimes it ran wel for a couple of days. The last compile I did was after the 19th November update, which seemed more stable than the current version Moode is using – apparently there were some tracks which made it crash. I could of course compile it and replace the current version in Moode v4.4 and let you know if it, in general, feels more stable. I'll try this anyways somewhere this week and report back. Besides that; I made a simple script which reset the service: cat /usr/local/bin/raspotifyre #!/bin/sh ssh pi@blackboxstreamer sudo systemctl restart raspotify This doesn't really work in the new setup, but switching the service on and off thru the website it tedious at best... Is there anyway to do this from the CLI? RE: Spotify Connect failures on Moode 4.4 - Tim Curtis - 01-07-2019 You could try this simple php script Code: #!/usr/bin/php sudo nano ./restartSpot.php paste script code into file save the file chmod 0755 ./restartSpot.php ./restartSpot.php RE: Spotify Connect failures on Moode 4.4 - sjoerdju - 01-07-2019 Ok, I updated librespot to the new version. I will not be able to make a hard comparison between two versions, but will report my general findings. Thnx for the script! The stopSpotify(); function doesn't seem to exist. I browsed thru the code, but cannot really find the proper function. I'll keep looking, but if you have an idea, it would be great. |