RPi-Jukebox-RFID icon indicating copy to clipboard operation
RPi-Jukebox-RFID copied to clipboard

🚀 | Raspotify (spotify-connect integration)

Open quottax opened this issue 4 years ago • 9 comments

Feature Description

I would like to connect Spotify by using spotify-connect (Raspotify) to my Phoniebox

What functionality would you like to see in your phoniebox?

I would like to have the feature to run "Raspotify" on the Phoniebox.

How do you envision the feature to work from a users perspective?

Would like to connect from my mobile phone with spotify app and with spotify-connect with the phoniebox.

Further information that might help

I tried to install raspotify and it works, but then the mopidy/Phoniebox doesnt work anymore. So it just works one or the other, not in harmony. Once one of both is running and playing music I’m not able to start playing the other one. In order to play music using Spotify Connect I need to manually stop the mopidy server and vice versa.

quottax avatar Mar 31 '20 12:03 quottax

im running raspotify on my phoniebox with a raspberry zero w. Its working well. Im running too this shairport, so the box is an wlan speaker too.

https://github.com/dtcooper/raspotify https://github.com/mikebrady/shairport-sync

ddbkva avatar Apr 03 '20 19:04 ddbkva

But how you do that? If i install raspotify it blocks the RPi-Jukebox-Software or it doesnt work when playing music over the MPD.

quottax avatar Apr 04 '20 14:04 quottax

Hi @quottax , I am playing around with raspotify as well, using mopidy. But what i realized is that i need to stop the music. it is not enough to pause the song.... Otherwise it gets the error that the device is still busy... Maybe one could add a command mpc stop somehow to raspotify: Edit: Found a solution: https://gist.github.com/danelowe/c2d301b3e6820cf131f1f09fe7b15874 seems to be working good in one direction : mopdiy->spotify but need to check if there is a solution the other way around

in order to check if one of the application is blocked: sudo journalctl -u mopidy -f journalctl -u raspotify -f

I got errrors like: Could not open audio device for playback. Device is being used by another application. (this one is in mopidy, the one of raspotify is similar) when the other application is blocking the audio output.

veloxidSchweiz avatar Apr 04 '20 20:04 veloxidSchweiz

Now i have a solution for the blocked audio output!

In the file /etc/default/raspotify i added this line:

OPTIONS="-v --device hw:sndrpihifiberry hw:0 --onevent /home/pi/setaudiodevice.sh"

File setaudiodevice.sh: #!/bin/bash if [ "$PLAYER_EVENT" = "start" ]; then mpc stop elif [ "$PLAYER_EVENT" = "stop" ]; then mpc stop fi

Now i can play spotify over raspotify even its running. I just need the other way around (Raspotify playing, Jukebox starting).

And the Volume-GPIO-Buttons dont work with Raspotify. I will look for a solution for this too.

quottax avatar Apr 05 '20 16:04 quottax

I tried to get a gpio control posibility via gpio buttons. There is an option using spotipy, creating a control app. (It is also not very easy to setup the system the first time if you are not used to it). I will look a little bit more into it. But need to think how it is made that it does not interfear with the main funtionality...

veloxidSchweiz avatar May 10 '20 05:05 veloxidSchweiz

Could you explain a little more what you expect?

Do you want that functionality in addition to the current Spotify integration?

What’s the difference between raspotify and the current integration (I don’t use Spotify, so I need some more info :) )?

s-martin avatar May 17 '20 09:05 s-martin

I would like to have it in the current Spotify integration. This would enable to see the Phoniebox as a device in the Spotify app, like a Google Home.

I will try to install it on my test setup and see if I can somehow integrate it into the current installation process.

Groovylein avatar Apr 02 '21 12:04 Groovylein

It does not look like there is a possibility with raspotify :( https://github.com/librespot-org/librespot/discussions/830#discussioncomment-1125550

So I will try https://github.com/Spotifyd/spotifyd let's see how I can stop and restart the daemon properly so that the playback is not doubled.

Groovylein avatar Aug 05 '21 12:08 Groovylein

Spotifyd will work on your Pi but independently from the Phoniebox software / Mopidy I believe. Not sure if they will sync as their are different approaches on how to play Spotify music.

pabera avatar Aug 05 '21 13:08 pabera