From c91e9cb8d8e6f0bf5edc0f5768f8dfd50a23d44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Tue, 16 Feb 2021 18:19:42 +0100 Subject: Show some stats and have links on premade finder --- main.py | 6 +++++- static/style.css | 9 --------- templates/lobby_html.jinja | 2 +- templates/premades_html.jinja | 29 ++++++++++++++++++++--------- templates/server_html.jinja | 2 +- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/main.py b/main.py index f5def41..e39eb5f 100755 --- a/main.py +++ b/main.py @@ -42,7 +42,10 @@ intervals = ( ('s', 1), ) -def display_time(seconds, granularity=2): +def display_time(timestamp, format="%d.%m.%Y"): + return datetime.datetime.fromtimestamp(timestamp).strftime(format) + +def display_age(seconds, granularity=2): result = [] for name, count in intervals: value = seconds // count @@ -54,6 +57,7 @@ def display_time(seconds, granularity=2): return ' '.join(result[:granularity]) app.jinja_env.filters['display_time'] = display_time +app.jinja_env.filters['display_age'] = display_age def grepSteamids(text): steamids = [] diff --git a/static/style.css b/static/style.css index a4837ee..9544769 100644 --- a/static/style.css +++ b/static/style.css @@ -85,15 +85,6 @@ div.player { padding: 0; /* border: 1px solid black; */ } -div.miniplayer { - display: inline-block; - width: 200px; - min-height: 50px; - text-align: center; - margin: 2px 5px 2px 5px; - padding: 0; - /* border: 1px solid black; */ -} /* Intern box of playerbox */ div.interna { display: inline-block; diff --git a/templates/lobby_html.jinja b/templates/lobby_html.jinja index 468a2fa..0564e55 100644 --- a/templates/lobby_html.jinja +++ b/templates/lobby_html.jinja @@ -78,7 +78,7 @@ (non-steam) {% else %} {% if profile['personastate'] == 0 %} - Offline since {{ (current_time - profile['lastlogoff']) | display_time }} + Offline since {{ (current_time - profile['lastlogoff']) | display_age }} {% else %} {{ states[profile['personastate']] }} {% endif %} diff --git a/templates/premades_html.jinja b/templates/premades_html.jinja index 7a45492..539815a 100644 --- a/templates/premades_html.jinja +++ b/templates/premades_html.jinja @@ -131,16 +131,27 @@
- {% for steamid in steamids %} - {# {{ profiles[steamid] }} #} -
- -
- {{ profiles[steamid]['personaname']|e }} - {% if 'timecreated' in profiles[steamid] %} -
{{ (current_time - profiles[steamid]['timecreated']) | display_time }} + {% for profile in profiles.values() %} +
+ +
+ {% if profile['communityvisibilitystate'] == 3 %} + Account erstellt am: {{ profile['timecreated'] | display_time }}
+ Spiele in Besitz: {{ profile['_ownedPlayedGames']|e }}
+ {% if profile['_userstats'] %} + Spielzeit: {{ profile['_userstats']['total_time_played']|display_age }}
+ {% else %} + Spielzeit: N/A + {% endif %} + {% else %} + Profile private {% endif %} - +
{% endfor %} diff --git a/templates/server_html.jinja b/templates/server_html.jinja index 5b530e5..3519dde 100644 --- a/templates/server_html.jinja +++ b/templates/server_html.jinja @@ -43,7 +43,7 @@ {{ player['name'] }} {{ player['score'] }} - {{ display_time(player['duration']) }} + {{ display_age(player['duration']) }} {% endfor %} -- cgit v1.2.3