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

Nope, as far as i know it is restricted to one user

It is possible. See solution above. I use it myself and it works.

Hi,
thanks for the guide. On issue, the audio is not very loud and when to full it becomes distorted.
Im using rp2. The output if from the HDMI cable. Any hints on that?
Cheers everyone

Hi guys,

Thanks for this, unfortunately I haven’t managed to run this. First of all, the app key is not available at that location anymore. I did get my own for Volumio a few weeks ago (although I didn’t end up needing it). However, I cannot successfully start the Spotify Server:

~$: ./spotify-connect-web.sh -o hw:0 --username xxx@yyy.com --password zzz --bitrate 320 --name Test
Loading Spotify library...
Device has no native mute
min_volume_range: 0.0
Using libspotify_embedded version: master-v1.5.0-gfba69d71
SpInit: 0
Traceback (most recent call last):
  File "main.py", line 56, in <module>
    connect_app = Connect(web_error_callback, web_arg_parser)
  File "/usr/src/app/connect.py", line 87, in __init__
    lib.SpPlaybackUpdateVolume(mixer_volume)
OverflowError: integer 477750 does not fit '16-bit unsigned int'

Any idea what’s causing this? I’m using an Rpi 3 with Hifiberry DAC+. Was thinking if it could be the app key conversion mentioned by @Sjohn21 (Original Post) or something completely different? Could someone maybe send me a copy of the volumio key file?

Cheers,
Johannes

Try adding ‘- - mixer Analogue’ or ‘- - mixer Digital’.

1 Like

That did it, you’re a champion, @karower! Let’s hope there’s going to be an alternative, once Spotify stops supporting this.

Thanks a million you guys!

Is it possible for OSMC to display what’s being played through Spotify?

Yes there is. But it needs improvement.

@dscho,

First of all, the app key is not available at that location anymore.

Unfortunately you seem to be right. I don’t know where else to download the key, but different keys may work. When I google the key, multiple search results are found, but I’m not sure about the quality and safety of those. I changed the howto to request the key at Spotify. It may take a bit longer, alas…

Works great with family accounts, thanks!

Hi !

I just re-installed my osmc on a fresh raspberry-pi and yes, the key location moved in the volumio deposit :confused:
The appkey extracted in the volumio app moved. Fortunately, searching in old commits, i found one and it works on my installation.

Here is the link : volumio-plugins/spotify_appkey.key at 7875f6d129a470eba6282296e06a7d17171b2653 · balbuze/volumio-plugins · GitHub

Hey all, i’m freaking out. i’ve installed connect server via above steps and all is fine.

however, when i start and select devive on my phone i don’t get any sound :frowning:

i start the server like normal and receive the following error:

osmc@osmc:~/spotify-connect-web$ ./spotify-connect-web --username 11ddddddddd34 --password xxxxxx --bitrate 320 --name osmc2
Loading Spotify library…
min_volume_range: 0.0
Using libspotify_embedded version: release-esdk-1.20.0-v1.20.0-g594175d4
SpInit: 0
playback_volume: 65535
corected_playback_volume: 100
public key: ls4fFeLyKjwb2yB5kCw1RrHg/LRHsW1NQrsl//0hJs/ohjV5tO9+IRMVbjusEOhwNsu5mAsrBCJVXAMzSGAMFa4J8oCC0DVKBoOPGCahq4W8PbqExgGTLLo7fN8cXmMc
device id: 83462013-e8d3-49be-aa1f-021970a7f136
remote name: osmc2
account req: PREMIUM
device type: AUDIODONGLE
kSpConnectionNotifyLoggedIn
8RufvFtXR5kQrJPFxwKKY8/V0pHMDtn+1XHCIEFmTiN4ivVB2eNOxaLhQNL+hfRB
kSpPlaybackNotifyPause
kSpPlaybackNotifyShuffleEnabled
playback_seek: 94247
kSpPlaybackNotifyTrackChanged
kSpPlaybackNotifyPlay
playback_seek: 94287
kSpPlaybackNotifyBecameActive
kSpPlaybackNotifyTrackChanged
playback_seek: 95985
kSpPlaybackEventAudioFlush
kSpPlaybackNotifyPlay
ALSA lib confmisc.c:768:(parse_card) cannot find card ‘default’
ALSA lib conf.c:4241:(_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:4241:(_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:4241:(_snd_config_evaluate) function snd_func_refer returned error: No such device
ALSA lib conf.c:4720:(snd_config_expand) Evaluate error: No such device
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM default:CARD=default
Unable to acquire device: No such device [default:CARD=default]
kSpPlaybackNotifyPause

i’ve added --playbackdevice and every option off the aplay -L command but there’s no sound :frowning:
also selected hdmi force hotplug and read about everything there’s to read.

installed 2 separate pi’s one krypton and one jarvis both same result.

could someone please point me in the right direction?

also i’ve installed via the older way a couple of months ago when the instuctions were different and it used to work, butt due to corrupt sd card i had to reinstall pi.

setup 1: pi, osmc, tv
setup 2: pi osmc, receiver, tv

on both setups audio from media(movies e.g.) are working fine.

regards

Don’t know how, but at the home setup adding --playback_device Works!

Still curious to why it didn’t work on other box and right out of the box like the last time.

But at least i can listen at home again.

Thumbs up for this!

As Spotify-premium user you can stream Spotify to your OSMC based Kodi player (through any Android, Windows or Apple device with Spotify installed).
Tested on RPi 3 with OSMC 2016.12-1
joe root
hr@ Finance Assignment Help

Hello!
I’m quite new (first post) in this forum, but I’ve spent hours and hours in searching and solving my osmc-issues.
Thanks a lot all of you guys for supporting noobs like me with amazing HowTo’s and descriptions of all kind!!

As I tried to find out a convenient way of playing spotify (premium) and switching back to osmc for watching movies etc. I came up with that (probably interesting for people using the HiFiBerry-DAC+
(first my setup):

  • Rp2 B
  • HiFi-Berry DAC+
  • MSL RemotePi Board

I used this and other HowTo’s to setup spotify-connect. Unfortunately i couldn’t manage to install an alsa mixer (like proposed in another thread) to be able to listen to osmc and spotify simultaneously.
So after finding out that this was my command to run spotify:
./spotify-connect-web.sh --name osmc -o hw:0 --username xxx --password xxx --bitrate 320
(a few weeks ago it only worked with --mixer Analogue)
and after installing the scs.service script,
I tried to make a shortcut to start and stop the spotify-service.

I made two scripts in /home/osmc :
startscs.sh
#!/bin/bash sudo systemctl start scs
stopscs.sh
#!/bin/bash sudo systemctl stop scs

and called them via my Favourites folder in OSMC by adding them to the favourites.xml file in /home/osmc/.kodi/userdata
<favourites> ... <favourite name="Start Spotify">System.Exec(&quot; /home/osmc/startscs.sh&quot;)</favourite> <favourite name="Stop Spotify">System.Exec(&quot; /home/osmc/stopscs.sh&quot;)</favourite> ... </favourites>

Using Yatse as remote control it’s even possible to start the spotify connect service via “Custom Command”:
In Yatse (being connected to kodi) I added a custom command shortcut in the upper right corner
Add from Media Center -> Call built-in
Display Name “Start Spotify”
Built-in command “System.Exec(”/home/osmc/startscs.sh")
same for “Stop Spotify”…

Now I can switch on and off spotify with the TV off.

I hope this may help somebody.

One issue in the and:
My spotify connect service is not able to adjust the volume of my hifiberry. Does anybody have an idea how to change that?

Thanks in advance!

edit:
with the description of @keab everything works (i don’t know why i couldn’t do it before )
THX!!

Thanks for the usefull addition. An interesting option. Maybe I’ll give it a try sometime.

Thank you for your nice tutorial. But i have a question. OSMC can output its sound to the analoge and hdmi port at the same time. Is there a way for spotify connect web to do it the same way? Becasue i cant get it to work

Hey!

I have Vero 2. I managed to get spotify-connct to work, but a few weeks ago I had to reinstall my Vero. Now I can’t get Spotify to work anymore. Can somebody help me?

First I got error

min_volume_range: 0.0
Using libspotify_embedded version: master-v1.5.0-gfba69d71
SpInit: 0
Traceback (most recent call last):
  File "main.py", line 56, in <module>
connect_app = Connect(web_error_callback, web_arg_parser)
  File "/usr/src/app/connect.py", line 87, in __init__
lib.SpPlaybackUpdateVolume(mixer_volume)
OverflowError: integer 681564 does not fit '16-bit unsigned int'

As suggested in this thread, I tried to put --mixer Digital or --mixer Analogue to a command, but another error occurred. Can anybody say what is wrong and how can I fix this?

./spotify-connect-web.sh -o hw:0 --username xxxx --password xxxx --bitrate 320 --name OSMC --mixer Digital

Loading Spotify library...
Traceback (most recent call last):
  File "main.py", line 14, in <module>
    from connect import Connect
  File "/usr/src/app/connect.py", line 9, in <module>
    from console_callbacks import audio_arg_parser, mixer, error_callback, connection_callbacks, debug_callbacks, playback_callbacks, playback_setup
  File "/usr/src/app/console_callbacks.py", line 104, in <module>
    mixer = alsa.Mixer(args.mixer, **mixer_card_arg)
alsaaudio.ALSAAudioError: Unable to find mixer control Digital,0 [default]

Anyone got a key lately? I requested mine a month ago, and nothing so far… :frowning:

I downloaded mine from the link provided in this thread: volumio-plugins/spotify_appkey.key at 7875f6d129a470eba6282296e06a7d17171b2653 · balbuze/volumio-plugins · GitHub