2014-07-24 04:27:35 +00:00
|
|
|
import pprint
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import spotipy
|
2014-08-22 17:46:21 +00:00
|
|
|
import spotipy.util as util
|
2014-07-24 04:27:35 +00:00
|
|
|
|
|
|
|
scope = 'user-library-read'
|
|
|
|
|
|
|
|
if len(sys.argv) > 2:
|
|
|
|
username = sys.argv[1]
|
|
|
|
tids = sys.argv[2:]
|
|
|
|
else:
|
|
|
|
print "Usage: %s username track-id ..." % (sys.argv[0],)
|
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
token = util.prompt_for_user_token(username, scope)
|
|
|
|
|
|
|
|
if token:
|
|
|
|
sp = spotipy.Spotify(auth=token)
|
|
|
|
sp.trace = False
|
2014-08-22 17:40:15 +00:00
|
|
|
results = sp.current_user_saved_tracks_contains(tracks=tids)
|
2014-07-24 04:27:35 +00:00
|
|
|
pprint.pprint(results)
|
|
|
|
else:
|
2014-08-22 17:40:15 +00:00
|
|
|
print "Can't get token for", username
|