Example #1
0
def streamPlaylistDownload():
	print request.data
	playlist = request.args.get('playlist')
	print playlist


	return

	tracks = playlist['tracks']
	playlist_name = playlist['name']
	message = playlist['message']
	owner = playlist['user']
	playlist_id = int(time.time())

	# create playlist
	createNewPlaylist(playlist_id, playlist_name, message, owner)

	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

	return Response(stream_with_context(generate()))
Example #2
0
def streamPlaylistDownload():
    print request.data
    playlist = request.args.get('playlist')
    print playlist

    return

    tracks = playlist['tracks']
    playlist_name = playlist['name']
    message = playlist['message']
    owner = playlist['user']
    playlist_id = int(time.time())

    # create playlist
    createNewPlaylist(playlist_id, playlist_name, message, owner)

    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

    return Response(stream_with_context(generate()))
Example #3
0
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})
Example #4
0
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})