Beispiel #1
0
def remove():
    track = request.form['track']
    username = request.form['username']
    password = request.form['password']
    platform = request.form['platform']
    playlist = request.form['playlist']
    if username and password and platform and playlist:
        track = track.split(",")[0];
        list = None;
        if platform == 'google music':
            googlemusic.setup(username,password)
            list = googlemusic.remove(track, playlist)
        if platform == 'spotify':
            list = spotify.remove(track, playlist)
Beispiel #2
0
def loadSongs():
    playlistName = request.form['playlistName']
    username = request.form['username']
    password = request.form['password']
    platform = request.form['platform']
    if username and password and platform and playlistName:
        list = None;
        if platform == 'google music':
            googlemusic.setup(username,password)
            list = googlemusic.getPlaylist(playlistName)
        if platform == 'spotify':
            list = spotify.getPlaylist(playlistName)
        return jsonify({'songs' : list})
    return jsonifiy({'songs' : []})
Beispiel #3
0
def getPlaylist():
    username = request.form['username']
    password = request.form['password']
    platform = request.form['platform']
    print('%s %s %s' % (username, password, platform))
    if username and password and platform:
        list = None;
        print(platform)
        if platform == 'google music':
            googlemusic.setup(username,password)
            list = googlemusic.getAllPlaylists()
            print("aaaaa")
        if platform == 'spotify':
            list = spotify.getAllPlaylists()
        print(list)
        return jsonify({'playlists' : list})
    return jsonify({'playlists' : []})
Beispiel #4
0
def search():
    songName = request.form['songName']
    susername = request.form['susername']
    spassword = request.form['spassword']
    gusername = request.form['gusername']
    gpassword = request.form['gpassword']
    googlemusic.setup(gusername,gpassword)
    list1 = [];
    if gusername and gpassword:
        list1 = googlemusic.search(songName)
    list2 = [];
    if susername and spassword:
            list2 = spotify.search(songName)
    list = [];
    for i in range(min(len(list1),len(list2))):
        list.append({'track': list1[i], 'platform' : 'google music'});
        list.append({'track': list2[i], 'platform' : 'spotify'});
    return jsonify({'songs' : list})