def generate(): for song in tracks: result_dict = download(song['url'], song['artist'], song['track']) print 'successfully downloaded ' print result_dict saveTrack(playlist_id, song['track'], song['artist'], owner) yield 'data:' + song['artist'] + ' - ' + song['track'] + '\n\n' print 'here handlePlaylistDownload' playlistURL = generatePlaylistURL(owner, playlist_id) yield 'data:' + playlistURL
def handlePlaylistDownload(): playlist = request.get_json() tracks = playlist['tracks'] playlist_name = playlist['name'].replace("'", '') message = playlist['message'].replace("'", '') owner = playlist['user'] playlist_id = int(time.time()) # create playlist createNewPlaylist(playlist_id, playlist_name, message, owner) for song in tracks: saveTrack(song['url'], playlist_id, song['track'], song['artist']) playlistURL = generatePlaylistURL(owner, playlist_id) return jsonify({'playlistURL': playlistURL})
def handlePlaylistDownload(): playlist = request.get_json() tracks = playlist['tracks'] playlist_name = playlist['name'].replace("'",'') message = playlist['message'].replace("'",'') owner = playlist['user'] playlist_id = int(time.time()) # create playlist createNewPlaylist(playlist_id, playlist_name, message, owner) for song in tracks: saveTrack(song['url'], playlist_id, song['track'], song['artist']) playlistURL = generatePlaylistURL(owner, playlist_id) return jsonify({'playlistURL':playlistURL})