Beispiel #1
0
def test_full_annotation():

    tids = ["09CtPGIpYB4BrO8qb1RGsF", "4phICvcdAfp3eMhVHDls6m"]
    for tid in tids:
        tlib.make_track(tid, 'fake_name', 'fake_artist', 1, 'test')

    _annotate_tracks_with_spotify_data_full(tids)
    _annotate_tracks_with_audio_features(tids)

    for tid in tids:
        track = tlib.get_track(tid)
        print json.dumps(track, indent=4)
        print
Beispiel #2
0
def test_full_annotation():

    tids = ["09CtPGIpYB4BrO8qb1RGsF", "4phICvcdAfp3eMhVHDls6m"]
    for tid in tids:
        tlib.make_track(tid, 'fake_name', 'fake_artist', 1, 'test')

    _annotate_tracks_with_spotify_data_full(tids)
    _annotate_tracks_with_audio_features(tids)

    for tid in tids:
        track = tlib.get_track(tid)
        print json.dumps(track, indent=4)
        print
Beispiel #3
0
 def next_track(self):
     track = None
     if self.count > 0:
         track = tlib.make_track(self._fake_id(), 
             self._fake_name(), self._fake_name(), 180, 'FakeTrackSource')
         self.count -= 1
     return track
Beispiel #4
0
    def _get_path(self, start, end):
        params = {'start': start, 'end': end}
        response = requests.get(
            'http://labs2.echonest.com/ArtistGraphServer/find_path',
            params=params)

        js = response.json()

        tracks = []
        for artist in js['path']:
            track = random.choice(artist['songs'])
            tid = 'spotify:track:' + track['id']
            # TODO fix duration here
            tlib.make_track(tid, track['title'], artist['name'], 180, 'frog')
            tracks.append(tid)
        return tracks
Beispiel #5
0
    def _get_path(self, start, end):
        params = {
            'start' : start,
            'end' : end
        }
        response = requests.get('http://labs2.echonest.com/ArtistGraphServer/find_path', 
            params=params)

        js = response.json()

        tracks = []
        for artist in js['path']:
            track = random.choice(artist['songs'])
            tid = 'spotify:track:' + track['id']
            # TODO fix duration here
            tlib.make_track(tid, track['title'], artist['name'], 180, 'frog')
            tracks.append(tid)
        return tracks
Beispiel #6
0
def _add_track(source, track):
    dur = int(track['duration_ms'] / 1000.)
    tlib.make_track(track['id'], track['name'], 
                track['artists'][0]['name'], dur, source)
    tlib.annotate_track(track['id'], 'spotify', _flatten_track(track))
Beispiel #7
0
def _add_track(source, track):
    dur = int(track['duration_ms'] / 1000.)
    tlib.make_track(track['id'], track['name'], track['artists'][0]['name'],
                    dur, source)
    tlib.annotate_track(track['id'], 'spotify', _flatten_track(track))
Beispiel #8
0
def _add_track(source, track):
    dur = int(track['duration_ms'] / 1000.)
    tlib.make_track(track['id'], track['name'], track['artists'][0]['name'],
                    dur, source)
Beispiel #9
0
def _add_track(source, track):
    dur = int(track['duration_ms'] / 1000.)
    tlib.make_track(track['id'], track['name'],
                track['artists'][0]['name'], dur, source)
Beispiel #10
0
def _add_song(source, song):
    id = utils.uri_to_id(song['tracks'][0]['foreign_id'])
    dur = int(song['audio_summary']['duration'])
    tlib.make_track(id, song['title'], song['artist_name'], dur, source)
    tlib.annotate_track(id, 'echonest', _flatten_en_song(song, id))
    return id
Beispiel #11
0
def _add_song(source, song):
    id = utils.uri_to_id(song['tracks'][0]['foreign_id'])
    dur = int(song['audio_summary']['duration'] )
    tlib.make_track(id, song['title'], song['artist_name'], dur, source)
    tlib.annotate_track(id, 'echonest', _flatten_en_song(song, id))
    return id