[HowTo] Spotify-Connect support via Raspotify (LibreSpot)


#1

Get SPOTIFY-CONNECT on your OSMC device, turning your TV or HiFi/Surround receiver into a Spotify player! This is cool, it works flawlessly for Spotify Premium users!
You simply use the Spotify app on your phone/laptop. Your OSMC device will appear as “Devices Availabe” and when you select it, it looks like this:


This solution will install Raspotify, which is based on LibreSpot.

Installing it automatically:
Use my autosetup.sh script. All you have to do is select Spotify and fill in the name you want to see (like “OSMC” in the screenshot below). It will automatically set the quality to the highest and add a service in MyOSMC so you can disable/enable Spotify with your TV remote (default = enabled).

Installing it manually:
The below is copy-pasted from Raspotify’s Readme on Github. These are the manual instructions (the autosetup.sh script just performs them for you). You can change quality and set device name manually.

Raspberry Pi
First add the repo and its GPG key:

curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo apt-key add -v -
echo 'deb https://dtcooper.github.io/raspotify jessie main' | sudo tee /etc/apt/sources.list.d/raspotify.list

Now Install package:

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get -y install raspotify

VERO
(29/1/2018) Good news, it IS working on Vero 4k!
You just have to install it very manually via SSH, downloading the .deb package yourself:

  1. Download the latest .deb file for Raspotify:
    wget https://dtcooper.github.io/raspotify/raspotify-latest.deb

  2. Install it:
    sudo dpkg -i /home/osmc/raspotify-latest.deb

  3. Run this just to be sure all dependencies are met:
    sudo apt-get install -f

Changing quality and device name
Edit the config file:
sudo nano /etc/default/raspotify
And change bitrate to 320. This will essentially give you Ogg Vorbis -Q6 which is Spotify’s Extreme setting and hardly distinguishable from FLAC.

Afterwards, restart the service:
sudo systemctl restart raspotify

Check if it is running well:
sudo systemctl status raspotify

LIMITATIONS
Spotify-Connect and Kodi run side-by-side. You could playback something in Kodi and Spotify at the same time. Always make sure you stop Spotify playback before you play something in Kodi! Otherwise, you might need to reboot to get audio working in Kodi.

Other issues
If you have issues that are NOT related to installation, don’t post here. Create an issue here:
Raspotify on GitHub or Librespot on GitHub.


[HowTo] Setup a spotify-connect-web-server on a Raspberry Pi with OSMC
LibreSpot in the OSMC App Store
[HowTo] Setup a spotify-connect-web-server on a Raspberry Pi with OSMC
LibreSpot in the OSMC App Store
Update problem after failed LibreSpot addon setup
LibreSpot in the OSMC App Store
LibreSpot in the OSMC App Store
Wifi stopped working
LibreSpot in the OSMC App Store
LibreSpot in the OSMC App Store
Amazon and Spotify addons for OSMC/Kodi
#2

Works nicely. Even with a Hifiberry DIGI+.

Although… I have 2 Rpi3’s (both OSMC). With the second one, I had the following notification:

E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?

So, after an additional sudo apt-get install apt-transport-https it got installed.

BTW, I used the sudo nano /etc/default/raspotify. I was a bit surprised it was an empty file. But when I filled it with this, it worked:

DEVICE_NAME=“speelkamer”

BITRATE=“320”

OPTIONS="–device hw:0"

(The --device hw:0 part was necessary for the second Rpi, of which I use the jack output).


#3

Ah I totally forgot about apt-transport-https. I tested my autosetup script by uninstalling the raspotify package but forgot I had also installed apt-transport-https. I added it to the post.

Did your Hifiberry DIGI+ work out of the box? You only needed to add this for the jack output of the second RPi?


#4

Thanks a lot for this nice tutorial and the amazing script! Apart from one issue it works perfectly for me:
If i don’t add username and password to /etc/default/raspotify, i cannot find my device in the app. As soon as i add the arguments --username and --password and restart the service, it appears immediately.
Do you have any idea how to solve that? I really would like to let everyone in my wifi access the client.

Thx


#5

Strange, it worked for me without any user info. You only need to add user info if you want to play to your device while not connected to your local network.

I have it working in 2 houses now, didn’t do anything different. I have only used the Android Spotify app, what are you using?

you can create an issue on Github, perhaps the creator of Raspotify knows whats going on:
https://github.com/dtcooper/raspotify/issues

Otherwise it’s an issue with your network/devices.


#6

I also use the Spotify App on android and with Windows the raspotify client doesn’t appear neither. I’m gonna restart my router, reset all network settings and look if something changed…
Otherwise I’ll try to get help on github.


#7

Thanks for your post @zilexa - I have this working on two separate Pi’s at home.

But i am having a few issues that maybe someone can help with:

  1. Is the default raspotify volume always starting at 100% - is there a way to start it out much lower by default? The volume controls via spotify are slow and clumsy from my android device.

2a) How are you handling OSMC sound and raspotify sound?
By default when i install it (for testing) all sound is coming out via HDMI, OSMC and raspotify can both play together at the same time - is this normal?

2b) Both the Pi’s are running dac hats, The first is a Hifiberry AMP+ and the other Suptronics x400.
When i change the soundcard overlay to the hat i run into some conflict - the raspotify sound will play out the hat only if OSMC is set to hdmi. If they are both set to the hat output OSMC seems to overide raspotify?

This is not a deal breaker but ideally i could have both outputting sound via the hats and if possible have one stop the other when play started?

Possible? Any suggestions on where to start?


#8

This doesn’t happen for me (volume 100%). My RPi is directly connected via HDMI to the receiver. But the volume level is just normal. I do experience slow volume control from my Android phone.

I am never in the situation where that can possibly happen. When I am playing music, the TV is usually off and I am busy doing things. By the time I am free to sit on the couch and watch something, I have turned off the music and turned on the tv. But you are probably right and it makes sense since they use the same output. Since Raspotify is not a Kodi addon, it makes sense since it’s running in parallel. I have no desire of having one stop the other but if you want it, ask the creator to create a Kodi Addon.

This is far beyond me.

I think if anyone has issues actually using this, best is to create a ticket on Github for Raspotify or LibreSpot.
If you have trouble with installation, write it here.


#9

Thanks for the quick reply zilexa.

I have been running both these Pi’s as headless music players and after a far bit of experimentation i have found that Kodi paired with Kodi Music Remote (http://kodimusicremote.com/) on our ipads is best way to control and queue a large music collection easily. I have tried most of the other Pi options and have used ROON also but it seems nothing has all the options i want.
Kodi/OSMC/Libreelec comes close - but airplay streaming of spotify is flakey and not possible to stream from android.

This looked like the perfect answer.

Thanks for your suggestions - I will continue hunting for the elusive perfect solution.


#10

Someone has created a Kodi addon based on LibreSpot! I don’t use it because the addon tries to be a full Spotify solution instead of simply being a Spotify Connect headless solution. But you can try that.

This is the addon:https://forum.kodi.tv/showthread.php?tid=265356
and have a look at this post and the reply: https://forum.kodi.tv/showthread.php?tid=265356&pid=2648150#pid2648150


#11

I can’t seem to make my RPi 3 to output the audio through Jack only… I’ve tried --device hw:0 but it keeps sending audio through HDMI only, not even both of them, only HDMI is working…

How can I check my audio hardware devices?


Update problem after failed LibreSpot addon setup
#12

Create an issue on Github via the links provided at the end of the first post. I only know how to install it and playback via HDMI normally.


#13

I know the instructions say RPi3 tested only - but has anyone got the autosetup.sh fully worknig on the RPi2?

I have run the autosetup.sh with all '1’s to install everything. Only raspotify is working…


#14

Works here very good so far! Had to use the --device hw:1 for my USB DAC. Thank you very much now I dont have to use my bluetooth anymore this is so much better!


#15

Did your Hifiberry DIGI+ work out of the box? You only needed to add this for the jack output of the second RPi?

Yes, it did, alltough I’ve been tampering with settings in the past, so I can’t garantee it for everyone else.
The other Rpi didn’t, because it wasn’t a Hifiberry, but jack. But since installation everything still works perfectly. Not a single error.


#16

works perfect


#18

Worked like a charm :slight_smile:


#19

Hi, I would like to know if it is necessary to have a premium account.
Thanks in advance


#20

Yes, Spotify Connect by itself is only for premium users. So any solution for OSMC to use Spotify Connect on your device can only be for Spotify Premium users.


#21

Worked like a charm. Raspberry pi 3b with OSMC 2017.09-2. Thanks a lot!