Created
January 16, 2014 12:44
-
-
Save plamere/8454435 to your computer and use it in GitHub Desktop.
example of using creating genre radio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyen | |
import sys | |
en = pyen.Pyen() | |
if len(sys.argv) < 2: | |
print 'Usage: python genre_playlist.py seed genre name' | |
else: | |
genre = ' '.join(sys.argv[1:]) | |
response = en.get('playlist/static', type='genre-radio', genre_preset='core-best', genre=genre) | |
for i, song in enumerate(response['songs']): | |
print "%d %s by %s" % ((i +1), song['title'], song['artist_name']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
%python genre_playlist.py classic rock
1 Simple Man by Lynyrd Skynyrd
2 Born To Be Wild by Steppenwolf
3 All Along The Watchtower by Jimi Hendrix
4 Kashmir by Led Zeppelin
5 Sunshine Of Your Love by Cream
6 Let's Work Together by Canned Heat
7 Gimme Shelter by The Rolling Stones
8 It's My Life by The Animals
9 30 Days In The Hole by Humble Pie
10 Midnight Rider by The Allman Brothers Band
11 The Joker by Steve Miller Band
12 Fortunate Son by Creedence Clearwater Revival
13 Black Betty by Ram Jam
14 Heart Full Of Soul by The Yardbirds
15 Light My Fire by The Doors