Fornoth / spotify-connect-web

MIT License
435 stars 64 forks source link

Raspberry Pi 1 Model B #60

Closed mprahlkamps closed 8 years ago

mprahlkamps commented 8 years ago

Hello! Is there any way to get this to work with Raspberry Pi 1 Model B? I used this tutorial and then it works, but just for one user.

TimHausmann commented 8 years ago

it only works for the user with the credentials you used for the spotify-connect-web.sh

mprahlkamps commented 8 years ago

I've read on some other issues that you can use zeroconf for you to be able to use multiple accounts, right? But that is only available for RaspberryPi 2? If so, is there anything I can do to make the lates version work on RaspberryPi 1?

Thanks for your time!

TimHausmann commented 8 years ago

I wrote this guide to make it work for me. It uses the latest console_callbacks.py and works fine on a raspberry Pi 1 model B

mprahlkamps commented 8 years ago

@TimHausmann thanks, but that didn't change anything. For a single user the chroot works fine. (I don't know how outdated it is?) But I would like to use this like on the PS4, where multiple (premium)users can connect to a single account on the PS4 and change the music. Is there a possibility?

Fornoth commented 8 years ago

Use the command avahi-publish-service TestConnect _spotify-connect._tcp 4000 VERSION=1.0 CPath=/login/_zeroconf to have multi-user support https://github.com/Fornoth/spotify-connect-web#logging-in (I'll make that section in the README a little clearer)

mprahlkamps commented 8 years ago

Sorry for not being clearer. I already used this command.

I've just opened two ssh windows, on the first I used the command avahi-publish-service TestConnect _spotify-connect._tcp 4000 VERSION=1.0 CPath=/login/_zeroconf on the second I started the server with ./spotify-connect-web.sh --bitrate 320.

When I now try to connect it doesn't find the Raspberry. Is there anything wrong the way I do it?

EDIT:

When I use the zeroconf method, every time I start up a Spotify client this is what it's saying on the Raspberry:

192.168.178.23 - - [2016-07-06 17:31:04] "GET /login/_zeroconf?action=getInfo HTTP/1.1" 500 412 0.316407 192.168.178.25 - - [2016-07-06 17:31:04] "GET /login/_zeroconf?action=getInfo HTTP/1.1" 500 412 0.072721 192.168.178.23 - - [2016-07-06 17:31:25] "GET /login/_zeroconf?action=getInfo HTTP/1.1" 500 412 0.069789

EDIT2:

The same with -d :

`Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 508, in handle_one_response self.run_application() File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 494, in run_application self.result = self.application(self.environ, self.start_response) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request return self.view_functionsrule.endpoint File "main.py", line 172, in login_zeroconf return get_info() File "main.py", line 188, in get_info 'brandDisplayName': ffi.string(connect_app.init_vars['brandName']), AttributeError: Connect instance has no attribute 'init_vars' {'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': '192.168.178.52:4000', 'HTTP_KEEP_ALIVE': '0', 'HTTP_USER_AGENT': 'Spotify/103200096 Win32/0 (PC desktop)', 'PATH_INFO': '/login/_zeroconf', 'QUERY_STRING': 'action=getInfo', 'REMOTE_ADDR': '192.168.178.25', 'REMOTE_PORT': '3906', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'raspberrypi.fritz.box', 'SERVER_PORT': '4000', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7', 'werkzeug.request': <Request 'http://192.168.178.52:4000/login/_zeroconf?action=getInfo' [GET]>, 'wsgi.errors': <open file '', mode 'w' at 0xb6c670d0>, 'wsgi.input': <gevent.pywsgi.Input object at 0xb5839ef0>, 'wsgi.multiprocess': False, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)} failed with AttributeError

192.168.178.25 - - [2016-07-06 17:37:42] "GET /login/_zeroconf?action=getInfo HTTP/1.1" 500 161 0.230617 `

Fornoth commented 8 years ago

Try applying these changes to main.py (in /usr/src/app inside the chroot) https://github.com/Fornoth/spotify-connect-web/pull/16/files

mprahlkamps commented 8 years ago

Thank you very much! I'ts working now.

Great support :+1:

Fornoth commented 8 years ago

You're very welcome!

Rick7221 commented 8 years ago

I have a question about this multi-user support: How does it work with the appkeys? If i want to connect from different accounts, how do i specify the appkey files accordingly?

mprahlkamps commented 8 years ago

You just need one AppKey. On the main page at the very bottom you'll see how others can login.

mpyzara commented 8 years ago

If i put spotify-connect-web.sh to autostart should i use avahi command everytime the pi is started? Or it's enough to use this command once? Becouse after restarting pi spotify connect is working but i can't see it in my android app. After executing avahi command it appears. So if i always need to execute avahi command how can i put it in something like autostart in windows? Sometimes something strange is happening. My pi is not visible in android app for example after switching from one android app (with account A to another android app with Account B) If that happens i'm using avahi command and it's ok again. Is there any option to checking if avahi is still working and starting it again if its not?