def playlist_info(): if request.method != 'GET': return None print(current_user.username, current_user.userID) playlistID = request.args.get('id', type=int) r = MusicDatabase.getPlaylistsForUser(current_user.userID, playlistID) if not r: return {} r = r[0] result = {'id': r['id'], 'name': r['name'], 'type': r['playlist_type']} return jsonify(result)
def playlist_list(): if request.method != 'GET': return None result = [] for x in MusicDatabase.getPlaylistsForUser(current_user.userID): result.append({ 'id': x['id'], 'name': x['name'], 'type': x['playlist_type'] }) # print('playlist list', result) return jsonify(result)