Connect SNIPS with Spotify

Hello dear community,

i have been using snips for 2-3 months now and am really happy with it. I am currently only controlling my philipshue lamps.

I would also like to be able to control my Spotify with snips. Unfortunately it doesn’t work as it should, so I wanted to ask if one of you has a manual how to control spotify in the local network with the help of snips.

Thank you in advance

Yes, i do.

I use https://github.com/dtcooper/raspotify to make the raspberry a spotify connect device.

And spotipy https://github.com/Harrison97/spotipy to control the device via snips.

It is still work in progress, but so far i solved:

Login: On first login spotipy prints a URL to visit and asks for the redirected URL. I did this step by manually calling my action code from the virtual python Environment of the skill.

Spotify connect device not visible: i put my username and password in the config of raspotify, seems to work better.

There is still an open issue that the spotify token can’t be written to disk. I asked in another thread for any hints on this.

Can’t post any code atm as i’m writing on my mobile.

Burkhard

Hey Burkhard,
I would be really interested in your Snips app and action code. Would you mind to share? :slight_smile:
Thanks
Ben

Sure, i can share. Would the python action be sufficient? My App is quite crowded with several things (Spotiy, MPC/MPC, OpenHab, etc…) and actually its in german.

Here is a link to the basic action code: https://github.com/Padishar24/SnipsOpenHab/blob/master/spotify.zip

You’ll find more information how accessing spotify works under the project “spotipy”. Please google it.

Some few points of interest:

The login token is stored in the config.ini of your app / skill. I recommend to run at least one command manually from a python console startet from you skills folder under user _snips-skills as you need to open a url to grant snips access to spotify. This URL will be printed during the first login. The resultung redirected url need to be entered.

Maybe next year i’ll have some spare time to create a proper skill, if Snips is then still be public.

Best
Burkhard