Ejemplo n.º 1
0
 def next_track(self):
     track = self.source.next_track()
     if track:
         tinfo = tlib.get_track(track)
         print json.dumps(tinfo, indent=4)
         print
     return track
Ejemplo n.º 2
0
 def _save_playlist(self):
     self.saved = True
     f = open(self.playlist_name, 'w')
     out = []
     for tid in self.buffer:
         t = tlib.get_track(tid)
         if t:
             out.append(t)
         
     print >> f, json.dumps(out, indent=4)
     f.close()
Ejemplo n.º 3
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
Ejemplo n.º 4
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
Ejemplo n.º 5
0
 def next_track(self):
         
     while True:
         track = self.source.next_track()
         if track:
             tinfo = tlib.get_track(track)
             if tinfo['artist'].lower() not in self.bad_artists:
                 return track
             else:
                 if self.debug:
                     print 'filtered out', tlib.get_tn(track)
         else:
             break
     return track
Ejemplo n.º 6
0
    def next_track(self):
        while len(self.fillbuf) < self.annotator['batch_size']:
            track = self.source.next_track()
            if track:
                self.buffer.append(track)
                tinfo = tlib.get_track(track)
                if type not in tinfo:
                    self.fillbuf.append(track)
            else:
                break
        if len(self.fillbuf) > 0:
            self._fetch_fillbuf()

        if len(self.buffer) > 0:
            return self.buffer.pop(0)
        else:
            return None