mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
Reworked landing page
This commit is contained in:
parent
e40bc11f30
commit
15a9722325
@ -1,21 +1,21 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
{% if admin %}
|
||||
<p><a href="{{ url_for('user_index') }}">Users</a> | <a href="{{ url_for('folder_index') }}">Folders</a></p>
|
||||
{% endif %}
|
||||
|
||||
<h2>Artists</h2>
|
||||
<table>
|
||||
<tr><th>Id</th><th>Name</th></tr>
|
||||
{% for artist in artists %}
|
||||
<tr><td>{{ artist.id }}</td><td>{{ artist.name }}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<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>Hi!</h2>
|
||||
<p>There's nothing much to see here.</p>
|
||||
<p>
|
||||
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>
|
||||
for a list of compatible clients.<br />
|
||||
For now, this server has been tested on <em>MiniSub</em> and <em>Perisonic</em>.
|
||||
</p>
|
||||
|
||||
<h2>Stats</h2>
|
||||
<ul>
|
||||
<li>{{ stats.artists }} artists</li>
|
||||
<li>{{ stats.albums }} albums</li>
|
||||
<li>{{ stats.tracks }} tracks</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
12
web.py
12
web.py
@ -36,13 +36,17 @@ def teardown(exception):
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('home.html',
|
||||
artists = db.Artist.query.order_by(db.Artist.name).all(),
|
||||
albums = db.Album.query.join(db.Album.artist).order_by(db.Artist.name, db.Album.name).all())
|
||||
stats = {
|
||||
'artists': db.Artist.query.count(),
|
||||
'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')
|
||||
def reset_db():
|
||||
db.recreate_db()
|
||||
if UserManager.get(session.get('userid'))[1].admin:
|
||||
db.recreate_db()
|
||||
return redirect(url_for('index'))
|
||||
|
||||
import user
|
||||
|
Loading…
Reference in New Issue
Block a user