def run(self): url = "http://api.jamendo.com/get2/id+name+stream/track/json/?album_id=%s&streamencoding=ogg2" % self._album.id #print('get_tracks: %s' % url) tracks = get_json(url) for track in tracks: item = jamtree.Track(track['id'], track['name'].strip(), track['stream']) self._album.add_track(item) self._callback(self._album, self._add_to_playlist)
def run(self): url = "http://api.jamendo.com/get2/id+name+stream+album_id+album_name/track/json/?searchquery=%s&order=%s&n=%s&streamencoding=ogg2" % ( self.search_term, self.order_by, self.num_results) #print('get_track_list: %s' % url) tracks = get_json(url) track_list = [] for track in tracks: item = jamtree.Track(track['id'], track['name'].strip(), track['stream']) item.album_name = track['album_name'] track_list.append(item) if track_list == []: track_list = None self.callback(track_list)