Add Steam info
This commit is contained in:
@@ -14,6 +14,20 @@ from flask import (
|
||||
)
|
||||
|
||||
from .modules.api.lb import listens, listening
|
||||
from .modules.api.steam import recent, owned
|
||||
|
||||
def tmsmp(min: int) -> str:
|
||||
if min < 60:
|
||||
return f"{min} m"
|
||||
elif min < 60*24:
|
||||
return f"{min/60:.1f} h"
|
||||
else:
|
||||
return f"{min/60/24:.1f} d"
|
||||
|
||||
def rtmsmp(unix: int) -> str:
|
||||
return datetime \
|
||||
.utcfromtimestamp(unix) \
|
||||
.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
bp = Blueprint(
|
||||
"risdeveau",
|
||||
@@ -49,4 +63,12 @@ def mb_cover(mbid):
|
||||
|
||||
@bp.route("/")
|
||||
def index():
|
||||
return render_tmpl('index.html', lb=listens, lb_now=listening)
|
||||
return render_tmpl(
|
||||
'index.html',
|
||||
lb=listens,
|
||||
lb_now=listening,
|
||||
recent=recent.get('data', {}),
|
||||
owned=owned.get('data', {}),
|
||||
tmsmp=tmsmp,
|
||||
rtmsmp=rtmsmp
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user