mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-01-08 15:42:48 +00:00
Added show_tracks example
This commit is contained in:
parent
803e338366
commit
4f6aef7e79
@ -1,3 +1,4 @@
|
|||||||
v1.40, June 12, 2014 -- Initial public release.
|
v1.40, June 12, 2014 -- Initial public release.
|
||||||
v1.42, June 19, 2014 -- Removed dependency on simplejson
|
v1.42, June 19, 2014 -- Removed dependency on simplejson
|
||||||
|
v1.43, June 27, 2014 -- Fixed JSON handling issue
|
||||||
|
|
||||||
|
24
examples/show_tracks.py
Normal file
24
examples/show_tracks.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
'''
|
||||||
|
usage: show_tracks.py path_of_ids
|
||||||
|
|
||||||
|
given a list of track IDs show the artist and track name
|
||||||
|
'''
|
||||||
|
import sys
|
||||||
|
import spotipy
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
max_tracks_per_call = 50
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
file = open(sys.argv[1])
|
||||||
|
else:
|
||||||
|
file = sys.stdin
|
||||||
|
tids = file.read().split()
|
||||||
|
|
||||||
|
sp = spotipy.Spotify()
|
||||||
|
for start in xrange(0, len(tids), max_tracks_per_call):
|
||||||
|
results = sp.tracks(tids[start: start + max_tracks_per_call])
|
||||||
|
for track in results['tracks']:
|
||||||
|
print track['name'] + ' - ' + track['artists'][0]['name']
|
||||||
|
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
@ -3,7 +3,7 @@ from setuptools import setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='SpotipyWebApi',
|
name='SpotipyWebApi',
|
||||||
version='1.43',
|
version='1.44',
|
||||||
description='simple client for the Spotify Web API',
|
description='simple client for the Spotify Web API',
|
||||||
author="@plamere",
|
author="@plamere",
|
||||||
author_email="paul@echonest.com",
|
author_email="paul@echonest.com",
|
||||||
|
Loading…
Reference in New Issue
Block a user