MiczFlor / RPi-Jukebox-RFID

A Raspberry Pi jukebox, playing local music, podcasts, web radio and streams triggered by RFID cards, web app or home automation. All plug and play via USB. GPIO scripts available.
http://phoniebox.de
MIT License
1.32k stars 396 forks source link

🚀 | Raspotify (spotify-connect integration) #883

Open quottax opened 4 years ago

quottax commented 4 years ago

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.

ddbkva commented 4 years ago

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

quottax commented 4 years ago

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.

veloxidSchweiz commented 4 years ago

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.

quottax commented 4 years ago

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.

veloxidSchweiz commented 4 years ago

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...

s-martin commented 4 years ago

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 :) )?

Groovylein commented 3 years ago

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 commented 2 years ago

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.

pabera commented 2 years ago

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.