mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-23 01:16:18 +00:00
Reworked landing page
This commit is contained in:
parent
e40bc11f30
commit
15a9722325
@ -1,21 +1,21 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
{% if admin %}
|
||||||
<p><a href="{{ url_for('user_index') }}">Users</a> | <a href="{{ url_for('folder_index') }}">Folders</a></p>
|
<p><a href="{{ url_for('user_index') }}">Users</a> | <a href="{{ url_for('folder_index') }}">Folders</a></p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h2>Artists</h2>
|
<h2>Hi!</h2>
|
||||||
<table>
|
<p>There's nothing much to see here.</p>
|
||||||
<tr><th>Id</th><th>Name</th></tr>
|
<p>
|
||||||
{% for artist in artists %}
|
If you want to listen to some music, you'll have to use one of the available clients. See the <a href="http://www.subsonic.org/pages/apps.jsp">Subsonic website</a>
|
||||||
<tr><td>{{ artist.id }}</td><td>{{ artist.name }}</td></tr>
|
for a list of compatible clients.<br />
|
||||||
{% endfor %}
|
For now, this server has been tested on <em>MiniSub</em> and <em>Perisonic</em>.
|
||||||
</table>
|
</p>
|
||||||
|
|
||||||
<h2>Albums</h2>
|
|
||||||
<table>
|
|
||||||
<tr><th>Artist</th><th>Album</th></tr>
|
|
||||||
{% for album in albums %}
|
|
||||||
<tr><td>{{ album.artist.name }}</td><td>{{ album.name }}</td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
<h2>Stats</h2>
|
||||||
|
<ul>
|
||||||
|
<li>{{ stats.artists }} artists</li>
|
||||||
|
<li>{{ stats.albums }} albums</li>
|
||||||
|
<li>{{ stats.tracks }} tracks</li>
|
||||||
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
10
web.py
10
web.py
@ -36,12 +36,16 @@ def teardown(exception):
|
|||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
return render_template('home.html',
|
stats = {
|
||||||
artists = db.Artist.query.order_by(db.Artist.name).all(),
|
'artists': db.Artist.query.count(),
|
||||||
albums = db.Album.query.join(db.Album.artist).order_by(db.Artist.name, db.Album.name).all())
|
'albums': db.Album.query.count(),
|
||||||
|
'tracks': db.Track.query.count()
|
||||||
|
}
|
||||||
|
return render_template('home.html', stats = stats, admin = UserManager.get(session.get('userid'))[1].admin)
|
||||||
|
|
||||||
@app.route('/resetdb')
|
@app.route('/resetdb')
|
||||||
def reset_db():
|
def reset_db():
|
||||||
|
if UserManager.get(session.get('userid'))[1].admin:
|
||||||
db.recreate_db()
|
db.recreate_db()
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user