first commit

This commit is contained in:
Paul Lamere
2014-04-05 09:12:01 -04:00
commit dfced54992
8 changed files with 330 additions and 0 deletions

16
examples/show_artist.py Normal file
View File

@@ -0,0 +1,16 @@
# shows artist info for a URN or URL
import spotipy
import sys
import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
sp = spotipy.Spotify()
artist = sp.artist(urn)
pprint.pprint(artist)

View File

@@ -0,0 +1,15 @@
# shows track info for a URN or URL
import spotipy
import sys
import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:track:0Svkvt5I79wficMFgaqEQJ'
sp = spotipy.Spotify()
track = sp.track(urn)
pprint.pprint(track)

12
examples/tracks.py Normal file
View File

@@ -0,0 +1,12 @@
# shows tracks for the given artist
import spotipy
import sys
sp = spotipy.Spotify()
if len(sys.argv) > 1:
artist_name = ' '.join(sys.argv[1:])
tracks = sp.search(q=artist_name, limit=20)
for i, t in enumerate(tracks['tracks']):
print ' ', i, t['name']