Spotipy: Raspberry Pi playing music from Spotify automatically

Created on 19 Oct 2018  路  3Comments  路  Source: plamere/spotipy

This is not an issue on this library. I am trying to figure out how to get a Raspberry Pi to play music from Spotify when the user comes home. I have some python code that will let the Raspberry Pi know the user is home, now I just need to the music to play. I am wanting to know if this can be possible in anyway? I have asked this on Stack Overflow, but if you answer on here it is appreciated.

All 3 comments

There's a Python library for Spotify called Spotipy. You can check that out. https://spotipy.readthedocs.io/en/latest/

I had a similar requirement.
My Pi is running https://github.com/dtcooper/raspotify and thus behaves like a Spotify Connect Speaker.
In my Code I then connect to the Spotify Connect API and find the Device-ID of this instance by Name. With this ID you can now control the Music playing on this Speaker through the Web-API.

The relevant Code is here: https://github.com/MaZderMind/jukebox/blob/ddeadcd/software/jukebox/spotify.py

`Nice solution by @MaZderMind!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnySomebody1 picture AnySomebody1  路  3Comments

mcurranseijo picture mcurranseijo  路  3Comments

sheheryarbutt picture sheheryarbutt  路  5Comments

astralmedia picture astralmedia  路  4Comments

ElementO2512 picture ElementO2512  路  4Comments