mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-11 09:10:45 +00:00
Temporarily revert #428
This commit is contained in:
1 parent
bc7d49ca50
commit
26db832e24
5 files changed
+16
-70
No files matched your search
@@ -1,42 +0,0 @@
|
||||
# long running example (need to be authenticated via oauth)
|
||||
|
||||
import sys
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import spotipy
|
||||
import spotipy.util as util
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
username = sys.argv[1]
|
||||
else:
|
||||
print("Whoops, need your username!")
|
||||
print("usage: python user_playlists.py [username]")
|
||||
sys.exit()
|
||||
|
||||
SCOPE = ','.join([
|
||||
'user-modify-playback-state',
|
||||
'user-read-playback-state',
|
||||
'user-read-currently-playing'
|
||||
])
|
||||
|
||||
oauth = util.prompt_for_user_token(
|
||||
username,
|
||||
redirect_uri="http://localhost/",
|
||||
scope=SCOPE)
|
||||
|
||||
if oauth:
|
||||
sp = spotipy.Spotify(auth=oauth)
|
||||
# sp.trace = True
|
||||
# sp.trace_out = True
|
||||
start = datetime.now()
|
||||
while True:
|
||||
current_playback = sp.current_playback()
|
||||
print(datetime.now() - start,
|
||||
"is_playing?",
|
||||
None if current_playback is None
|
||||
else current_playback['is_playing'])
|
||||
|
||||
time.sleep(60)
|
||||
else:
|
||||
print("Can't get token for", username)
|
||||
Reference in new issue
Block a user