mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
22 lines
458 B
Python
22 lines
458 B
Python
import spotipy
|
|
from spotipy.oauth2 import SpotifyOAuth
|
|
from pprint import pprint
|
|
from time import sleep
|
|
|
|
scope = "user-read-playback-state,user-modify-playback-state"
|
|
sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope=scope))
|
|
|
|
# Shows playing devices
|
|
res = sp.devices()
|
|
pprint(res)
|
|
|
|
# Change track
|
|
sp.start_playback(uris=['spotify:track:6gdLoMygLsgktydTQ71b15'])
|
|
|
|
# Change volume
|
|
sp.volume(100)
|
|
sleep(2)
|
|
sp.volume(50)
|
|
sleep(2)
|
|
sp.volume(100)
|