From 7947b55297b295155e3afdc52a3f349ad330aa0e Mon Sep 17 00:00:00 2001 From: spl0k Date: Sat, 7 Dec 2013 19:19:33 +0100 Subject: [PATCH] Web UI update with client prefs. Saving don't do anything for now --- templates/profile.html | 26 ++++++++++++++++++++++++++ user.py | 5 +++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/templates/profile.html b/templates/profile.html index ba2281f..2bed2f3 100755 --- a/templates/profile.html +++ b/templates/profile.html @@ -18,5 +18,31 @@
  • Change password
  • + +{% if clients %} +

    Known streaming clients

    +
    + + + {% for client in clients %} + + + + + + + {% endfor %} +
    ClientFormatMax bitrateForget
    {{ client.client_name }}
    + +
    +{% endif %} {% endblock %} diff --git a/user.py b/user.py index 15634f3..8b38919 100755 --- a/user.py +++ b/user.py @@ -4,7 +4,7 @@ from flask import request, session, flash, render_template, redirect, url_for, m from web import app from managers.user import UserManager -from db import User, session as db_sess +from db import User, ClientPrefs, session as db_sess import uuid, csv import config from lastfm import LastFm @@ -23,7 +23,8 @@ def user_index(): @app.route('/user/me') def user_profile(): - return render_template('profile.html', user = UserManager.get(session.get('userid'))[1], api_key = config.get('lastfm', 'api_key')) + prefs = ClientPrefs.query.filter(ClientPrefs.user_id == uuid.UUID(session.get('userid'))) + return render_template('profile.html', user = UserManager.get(session.get('userid'))[1], api_key = config.get('lastfm', 'api_key'), clients = prefs) @app.route('/user/changemail', methods = [ 'GET', 'POST' ]) def change_mail():