besi / stereopi

MIT License
1 stars 0 forks source link

Skip Spotify songs #3

Open besi opened 4 years ago

besi commented 4 years ago
  1. Register the callback url in the spotify dashboard
  2. Open a website on the stereopi
  3. Redirect to the https://accounts.spotify.com/authorize?client_id=&redirect_uri=http://stereopi.local/callback&response_type=token&scope=user-modify-playback-state
  4. Get the token
  5. Use the token to skip the song:

     curl -X POST "https://api.spotify.com/v1/me/player/next" -H "Authorization: Bearer {OBTAINED_TOKEN}"

This will skip the song

https://stackoverflow.com/a/46369082/784318

besi commented 4 years ago
if key == 'KEY_FASTFORWARD': os.system('curl -X POST "https://api.spotify.com/v1/me/player/next" -H "Authorization: Bearer XYZ-ABC" &')
if key == 'KEY_REWIND': os.system('curl -X POST "https://api.spotify.com/v1/me/player/previous" -H "Authorization: Bearer XYZ-ABC" &')