1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 08:56:17 +00:00

Web UI update with client prefs. Saving don't do anything for now

This commit is contained in:
spl0k 2013-12-07 19:19:33 +01:00
parent 4cd1aace76
commit 7947b55297
2 changed files with 29 additions and 2 deletions

View File

@ -18,5 +18,31 @@
</li>
<li><a href="{{ url_for('change_password') }}">Change password</a></li>
</ul>
{% if clients %}
<h2>Known streaming clients</h2>
<form method="post">
<table>
<tr><th>Client</th><th>Format</th><th>Max bitrate</th><th>Forget</th></tr>
{% for client in clients %}
<tr>
<td>{{ client.client_name }}</td>
<td><input type="text" name="{{ client.client_name }}_format" value="{{ client.format if client.format else '' }}" /></td>
<td><select name="{{ client.client_name }}_bitrate">
<option />
<option {{ 'selected="selected"' if client.bitrate == 64 else '' }}>64</option>
<option {{ 'selected="selected"' if client.bitrate == 96 else '' }}>96</option>
<option {{ 'selected="selected"' if client.bitrate == 128 else '' }}>128</option>
<option {{ 'selected="selected"' if client.bitrate == 192 else '' }}>192</option>
<option {{ 'selected="selected"' if client.bitrate == 256 else '' }}>256</option>
<option {{ 'selected="selected"' if client.bitrate == 320 else '' }}>320</option>
</select></td>
<td><input type="checkbox" name="{{ client.client_name }}_delete" /></td>
</tr>
{% endfor %}
</table>
<input type="submit" value="Save" />
</form>
{% endif %}
{% endblock %}

View File

@ -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():