-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTrackInfo.py
More file actions
23 lines (16 loc) · 800 Bytes
/
testTrackInfo.py
File metadata and controls
23 lines (16 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from spotipy.oauth2 import SpotifyOAuth
import json
import spotipy
import time
import sys
DEVICE_ID="98bb0735e28656bac098d927d410c3138a4b5bca"
CLIENT_ID="d98ce18a07b645ff8d57e0de98ffc53f"
CLIENT_SECRET="80b66aa52bf64028964968a45036afab"
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
redirect_uri="http://localhost:8080",
scope="user-read-playback-state,user-modify-playback-state"))
sp.trace = True
trackInfo = sp.current_user_playing_track()
print(f"duration: {trackInfo['item']['duration_ms']}, progress: {trackInfo['progress_ms']}")
print(trackInfo['item']['name'])