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 handleSingleTrackDownload(): youtubeURL = request.args.get('youtubeURL') artistName = request.args.get('artistName') trackName = request.args.get('trackName') playlist_id = '' result_dict = saveTrack(youtubeURL, playlist_id, trackName, artistName) return jsonify(result_dict)
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})