Skip to content

Instantly share code, notes, and snippets.

@plamere
Created January 16, 2014 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plamere/8454435 to your computer and use it in GitHub Desktop.
Save plamere/8454435 to your computer and use it in GitHub Desktop.
example of using creating genre radio
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'])
@plamere
Copy link
Author

plamere commented Jan 16, 2014

%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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment