mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-07-30 14:00:18 +00:00
Packaging tweaks
This commit is contained in:
29
examples/create_playlist.py
Normal file
29
examples/create_playlist.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Creates a playlist for a user
|
||||
|
||||
import pprint
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
import spotipy
|
||||
|
||||
import util
|
||||
import spotipy.oauth2 as oauth2
|
||||
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
username = sys.argv[1]
|
||||
playlist_name = sys.argv[2]
|
||||
else:
|
||||
print "Usage: %s username playlist-name" % (sys.argv[0],)
|
||||
sys.exit()
|
||||
|
||||
token = util.prompt_for_user_token(username)
|
||||
|
||||
if token:
|
||||
sp = spotipy.Spotify(auth=token)
|
||||
sp.trace = False
|
||||
playlists = sp.user_playlist_create(username, playlist_name)
|
||||
pprint.pprint(playlists)
|
||||
else:
|
||||
print "Can't get token for", username
|
Reference in New Issue
Block a user