[HowTo] Setup a spotify-connect-web-server on a Raspberry Pi with OSMC

For some reason I think the path does not work. It says that the lines do not match.
I had to manually change the code and worked.

It could be that I’m missing something or that the path does not work anymore in the HEAD of master.

New Pi user, just bought Pi3 and installed Kodi, working great. Not exactly new to Linux, though - the Pi is replacing a Linux based media center that I ran for years…

Maybe I’ve got an odd use case but I can’t find anything so far that addresses this - is it possible to have a Pi direct audio to different outputs depending on the source program, as you can do on a full Ubuntu box?

On my old media center, MythTV outputted audio on HDMI (to my monitor), Spotify outputted to an analog sound card (to my AV receiver for distribution to the house…)

With that, someone could be watching something on TV while at the same time Spotify was running in the background (controlled via Android app) and sending music out to other zones in the house.

Can’t find any feature like this in my Pi, at least so far…

Maybe it’s just a limitation of the small hardware? My “full blown computer” media center was a a multi-core machine with lots of memory…

I’m thinking the solution might just be to ditch that idea and buy a second Pi, set it up and configure to just be an audio server rather than worrying about running both on the same machine - but having both run on the same Pi would be both convenient and an interesting challenge if possible…

Thanks!

Hi,
I’m totally Noob, I started my experience witch Raspberry 2 days ago, and using your’s tutorial I’m listening now my spotify on it. :slight_smile:
Thank’s.

Thank you so much for this wonderful guide to set up my OSMC Spotify-Connect server.

Though, I’m still wondering if it is possible to use the integrated volume control in Spotify. I wasn’t sure though if the volume control was made possible for osmc already or is still not working with this plugin? I’m using an USB DAC and can change the volume manually with the alsamixer, sound is great. Thank you!

Hi @zilexa

I tried to let the services run in parallel by installing spotify-connect-web twice in completely separated two “/home/osmc/spotify-connect-web-chroot”-folders.

So I have two spotify-connect-web-folders like:

  • /home/osmc/spotify-connect-web-chroot_userA
  • /home/osmc/spotify-connect-web-chroot_userB

After that I created two service-files, like you did:

  • spotify_connect_userA.service > pointing to - /home/osmc/spotify-connect-web-chroot_userA via its own spotify-connect-web_userA.sh
  • spotify_connect_userB.service > pointing to - /home/osmc/spotify-connect-web-chroot_userB via its own spotify-connect-web_userB.sh

On startup of the second (when the first is running), I get the following error:
socket.error: [Errno 98] Address already in use: (’ ', 4000)

This is of no wonder, because the other userA-service is already running.
I traced the error down to the Zeroconf-settings. In main.py:
if name == “main”:
Can be run on any port as long as it matches the one used in avahi-publish-service

I also found this in the readme.md:
Passwordless/Multiuser (Zeroconf/Avahi)
Zeroconf (Avahi) login can be used after executing the command avahi-publish-service TestConnect _spotify-connect._tcp 4000 VERSION=1.0 CPath=/login/_zeroconf (avahi-publish-service is in the avahi-utils package).

Any ideas, on how one can use multiple of theses Zeroconf/Avahi-instances in parallel with separate ports?

Thanks for this tutorial, but i have a question.
Is there a main difference between this option / tutorial, or the Spotify beta app?

@OSMCuser Please dont link that shitty site all it does is endorse piracy… so remove the link.

there are far better links for the emby repo than that site.

Didn`t know that, link has bin removed… wat kind of sites do you suggest then?

Something that doesn’t endorse piracy, that site has a notorious reputation and often bad advice and remember there are forum rules here on the forum that states that you cant promote piracy we follow the same rules as Kodi forum.

and here is probly a better link if its the same (since i dont use Spotify).
http://forum.kodi.tv/showthread.php?tid=265356

I’ve run through the steps above from Axel. I can see and connect to Spotify Connect on my device, but I get no sound when I play a song.

Latest stable OSMC, RP3B, (neither HDMI, Analogue, Both, or Alsa work for me)

Thanks

I assume this has something to do with it:

ALSA lib confmisc.c:768:(parse_card) cannot find card ‘default’
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such device
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such device
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such device
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default:CARD=default
Unable to acquire device: No such device [default:CARD=default]

Hi all.
I instaled server without any problems. (Once again thanks for your turtorial).
I have aquestion - is it possible to play spotify audio via Bluetooth?

Yes, that would be it I think. I’m not anyway near the rpi on which I did the spotify-connect-web install, so I’m afraid I can’t help much.
Have you tried asking spotify-connect-web to list the audio devices so you can try and pick another one? Though not working with the default card is never a nice sign…
This is also the sort of error that can happen when the ALSA sound device is being used by a user (say osmc) and another user tries to take control of it (say, root). So maybe check along those lines too.

This doesn’t have much to do with the processing power of the Pi, it’s really more a question of configuration.
The rpi has two physical sound outputs, HDMI and analog, and you can output to what you want with a bit of tweaking.

Check out this post, it explains a bit more how to do it.

Also, in the Kodi settings screen, you’ll find different options for sound: PI: analog, PI: HDMI and PI: analog + HDMI, so pick the one you want for Kodi and you can pick the other one for spotify-web-connect (for analog, amixer -c 0 cset numid=3 1 as said in the post).

Hope this helps.

Hello, thank you very much for the tutorial.
I have the problem, that under https://developer.spotify.com/my-account/keys
there is only a form to fill to get the app key sent, and when I do it, nothing happens… (waited for 2 weeks now)
Is there any other way, or does somebody know, how to get the appkey?

Thank you!

It was known Spotify would deprecate libspotify later this year, I guess it happened.
I completely messed up my Raspberry Pi a while ago, so nothing works. Will reinstall today and hopefully Spotify will still work with the old keys.

I am not sure what the new method will be to get Spotify Connect on your RPi. I guess the current method works for those who have a key.

I was able to extract the key from volumio Spotify plugin, I guess it is a short term solution but you could give a try…

I was looking for a way to integrate currently playing information and basic playback controls in Kodi gui.
I found an addon: https://github.com/noemu/plugin.audio.swcc
For sure it’s not perfect but the idea is great. Do you know any other ways to control Spotify Connect by Kodi gui?
I’m also looking for a way to automatically stop playback and realeasing the ALSA device as soon as Spotify Connect starts playing a song.

1 Like

Your guide worked excellent and Spotify is running quite nicely now on a rpi3 and the newest osmc (2016.12.1)… The only issue was getting the appkey, which honzejk was kind enough to point in an excellent direction haha.

I just changed the Howto a bit:

  1. The link to the download site. It now links to the latest release 0.0.3, like the instructions from Fornoth at Github.
  2. Works with multiple audio devices (see step 20c)
  3. In my experience this version of spotify-web (0.0.3) needs to be assigned an audio device. Command -o hw:0 is therefore added.