mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 03:54:20 +00:00
Add flask page
This commit is contained in:
parent
ab31249100
commit
628b82fcfd
2 changed files with 5 additions and 10 deletions
|
@ -25,7 +25,7 @@
|
||||||
{% if record["fav_song"] %}
|
{% if record["fav_song"] %}
|
||||||
<div class="game-title fav-video">Canzone preferita</div>
|
<div class="game-title fav-video">Canzone preferita</div>
|
||||||
<div class="game-score fav-video" title="{{ record["fav_song"] }}">
|
<div class="game-score fav-video" title="{{ record["fav_song"] }}">
|
||||||
{{ record["fav_song"] }}
|
<a href="/music/{{ record["discord_id"] }}">{{ record["fav_song"] }}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-extra fav-video">{{ record["max_plays"] }}x</div>
|
<div class="game-extra fav-video">{{ record["max_plays"] }}x</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
13
webserver.py
13
webserver.py
|
@ -342,20 +342,15 @@ def page_music():
|
||||||
return render_template("topsongs.html", songs=songs)
|
return render_template("topsongs.html", songs=songs)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/music/<name>")
|
@app.route("/music/<discord_id>")
|
||||||
def page_music_individual(name: str):
|
def page_music_individual(discord_id: str):
|
||||||
db_session = db.Session()
|
db_session = db.Session()
|
||||||
user = db_session.query(db.Royal).filter_by(username=name).one_or_none()
|
discord = db_session.query(db.Discord).filter_by(discord_id=discord_id).one_or_none()
|
||||||
if user is None:
|
|
||||||
db_session.close()
|
|
||||||
abort(404)
|
|
||||||
return
|
|
||||||
discord = db_session.query(db.Discord).filter_by(royal=user).one_or_none()
|
|
||||||
if discord is None:
|
if discord is None:
|
||||||
db_session.close()
|
db_session.close()
|
||||||
abort(404)
|
abort(404)
|
||||||
return
|
return
|
||||||
songs = db_session.execute(query_discord_music.single_top_songs, {"discordid": discord.id})
|
songs = db_session.execute(query_discord_music.single_top_songs, {"discordid": discord.discord_id})
|
||||||
db_session.close()
|
db_session.close()
|
||||||
return render_template("topsongs.html", songs=songs, discord=discord)
|
return render_template("topsongs.html", songs=songs, discord=discord)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue