Created
February 13, 2011 08:15
-
-
Save mattkatz/824540 to your computer and use it in GitHub Desktop.
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
from pyechonest import config | |
from pyechonest import catalog | |
import uuid | |
import time | |
def print_timing(func): | |
def wrapper(*arg): | |
t1 = time.time() | |
res = func(*arg) | |
t2 = time.time() | |
print '%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.0) | |
return res | |
return wrapper | |
config.ECHO_NEST_API_KEY="SIMO6BLBBMFIX3JIO" | |
songs=[ | |
{'artist':'0638ba22-040f-438d-83a5-9b670c4adaf5','artist_name':'ludacris','song_name':'Move Bitch',} | |
{'artist':'8067c102-4996-42bc-9980-06ce2e644eae','artist_name':'Soul Coughing','song_name':'Rolling'} | |
{'artist':'8067c102-4996-42bc-9980-06ce2e644eae','artist_name':'Soul Coughing','song_name':'Blame'} | |
{'artist':'8067c102-4996-42bc-9980-06ce2e644eae','artist_name':'Soul Coughing','song_name':'Circles'} | |
{'artist':'8067c102-4996-42bc-9980-06ce2e644eae','artist_name':'Soul Coughing','song_name':'Houston'} | |
{'artist':'8067c102-4996-42bc-9980-06ce2e644eae','artist_name':'','song_name':'Memorial'} | |
] | |
@print_timing | |
def create_random_catalog(): | |
catid = uuid.uuid1() | |
c = catalog.Catalog(str(catid),"song") | |
print "%s"% c.id | |
items = [{'action': 'update', | |
'item': { 'item_id': '38937DDF04BC7FC4', | |
}}] | |
ticket = c.update(items) | |
print "ticket: %s" % ticket | |
print "status: %s" % c.status(ticket)['ticket_status'] | |
while c.status(ticket)['ticket_status'] == 'pending': | |
print "waiting..." | |
time.sleep(3) | |
print "something changed" | |
print "status: %s" % c.status(ticket)['ticket_status'] | |
print c.read_items() | |
return c.id | |
def create_playlist_from_catalogue(): | |
return 2 | |
mycat = create_random_catalog() | |
#from pyechonest import artist | |
#bk_results = artist.search(name='bikini kill') | |
#if bk_results: | |
#bk = bk_results[0] | |
#print "Artists similar to: %s:" % (bk.name,) | |
#for similar_artist in bk.similar: | |
#print "\t%s" % (similar_artist.name,) | |
#else: | |
#print "Uh oh, couldn't find bikini kill" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment