RafaPolit / moode-spotify-connect-web

moOde OS - spotify-web-connect install instructions and required files.
MIT License
15 stars 4 forks source link

Connection drops after a couple of minutes #15

Open egekorkan opened 4 years ago

egekorkan commented 4 years ago

I managed to get everything working but in the end, the connection drops in a similar way to how embedded Spotify connect in Moode player drops. I get the following log messages by using journalctl -u spotify-connect-web.service

Apr 03 21:29:51 moodeege spotify-connect.sh[13356]: AttributeError: 'Request' object has no attribute 'is_xhr'
Apr 03 21:29:51 moodeege spotify-connect.sh[13356]: ::ffff:192.168.178.144 - - [2020-04-03 21:29:51] "GET /api/info/status HTTP/1.1" 500 426 0.003658
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]: [2020-04-03 21:29:56,343] ERROR in app: Exception on /api/info/status [GET]
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]: Traceback (most recent call last):
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     response = self.full_dispatch_request()
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     rv = self.handle_user_exception(e)
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/flask_cors/extension.py", line 188, in wrapped_function
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     return cors_after_request(app.make_response(f(*args, **kwargs)))
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     reraise(exc_type, exc_value, tb)
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     rv = self.dispatch_request()
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     return self.view_functions[rule.endpoint](**req.view_args)
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "main.py", line 153, in info_status
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     'logged_in': bool(lib.SpConnectionIsLoggedIn())
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/flask/json.py", line 254, in jsonify
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr:
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:   File "/home/pi/.local/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]:     return getattr(self._get_current_object(), name)
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]: AttributeError: 'Request' object has no attribute 'is_xhr'
Apr 03 21:29:56 moodeege spotify-connect.sh[13356]: ::ffff:192.168.178.144 - - [2020-04-03 21:29:56] "GET /api/info/status HTTP/1.1" 500 426 0.005533

Funny enough, I observe the same behavior when I use librespot with a command like librespot --name stablepi --bitrate 320 --initial-volume 50 --enable-volume-normalisation --linear-volume --verbose

Is there another underlying problem causing all this?

RafaPolit commented 4 years ago

Could it be that the RPi is losing internet connection?

Could it be there is a CPU limit that is causing it to stop? Which RPi is this? Maybe try with a wired connection to see if it improves?

egekorkan commented 4 years ago

I have a RPi 4 with 2GB of RAM and it is connected using the Ethernet port to the same network as my computer. How can I see if the CPU limit is causing this?