View gist:8976417
This file contains 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
Perhaps an analogy would help ... like comparing an API to a car dashboard. | |
The dashboard is the interface between the car and the human - it has all | |
the controls you need to make the car do its job. An API is like the | |
dashboard for a software system. It provides the interface for another | |
system (typically another computer) to get a system to do its job. |
View TrackUploadSample.m
This file contains 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
- (void) uploadTrack: (Track *) track { | |
NSDictionary *params = @{ | |
@"filetype" : @"m4a", | |
@"api_key" : self.apiKey, | |
}; | |
NSFileManager *fm = [NSFileManager defaultManager]; | |
NSURL *audioPath = [self pathToAudio:track]; | |
NSString *path = [audioPath path]; | |
NSData *data = [fm contentsAtPath:path]; |
View spotify_echonest_example
This file contains 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 spotipy | |
import sys | |
''' | |
get a set of images for artists that are similar to | |
the given seed artist | |
''' | |
en = pyen.Pyen() |
View parse.py
This file contains 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 sys | |
from bs4 import BeautifulSoup | |
import json | |
import pyen | |
en = pyen.Pyen() | |
def get_fid(artist, idspace): | |
if 'foreign_ids' in artist and len(artist['foreign_ids']) > 0: | |
for fids in artist['foreign_ids']: | |
if fids['catalog'] == idspace: |
View gist:e41f5a163566dddbeba4
This file contains 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
for start in xrange(0, 10000, page_size): | |
response = en.get('catalog/read', id=tpid, start=start, | |
results=page_size, bucket=['id:spotify']) | |
if len(response['catalog']['items']) == 0: | |
break | |
spaids = [] | |
for item in response['catalog']['items']: | |
if 'artist_name' in item: | |
spid = item['request']['item_id'] |
View cynical_radio.py
This file contains 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 pbl import * | |
gold = Concatenate([ArtistTopTracks('Sia'), ArtistTopTracks('Katy Perry')]) | |
norm = PlaylistSource("Today's Top Hits") | |
radio = Alternate([norm, norm, norm, Shuffler(gold)]) | |
radio = PlaylistSave(radio, 'cynical radio', 'plamere', max_size=40) |
View catalog_sample.py
This file contains 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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
Copyright (c) 2010 The Echo Nest. All rights reserved. | |
Created by Tyler Williams on 2011-04-08 | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2, or (at your option) |
View TopTwitter.html
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Top Twitter</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<link type="text/css" href="styles.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<h1 id='title'> Top 100 artists with verified Twitter accounts</h1> | |
<ol id="results"> </ol> |
View PlaylistWithDistribution.html
This file contains 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
!DOCTYPE html> | |
<html> | |
<head> | |
<title>Playlist Distribution Demo</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<link type="text/css" href="demo_styles.css" rel="stylesheet" /> | |
</head> | |
<body> |
View analysis.json
This file contains 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
{ | |
"bars": [ | |
{ | |
"confidence": 0.451, | |
"duration": 1.64692, | |
"start": 0.7151 | |
}, | |
{ | |
"confidence": 0.32, | |
"duration": 1.64778, |
OlderNewer