mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 03:54:20 +00:00
Add game pages
This commit is contained in:
parent
6df508ece3
commit
5552c92817
12 changed files with 199 additions and 140 deletions
6
db.py
6
db.py
|
@ -167,6 +167,7 @@ class Steam(Base):
|
||||||
raise RequestError(f"Game data is private")
|
raise RequestError(f"Game data is private")
|
||||||
self.most_played_game_id = j["response"]["games"][0]["appid"]
|
self.most_played_game_id = j["response"]["games"][0]["appid"]
|
||||||
|
|
||||||
|
|
||||||
class RocketLeague(Base):
|
class RocketLeague(Base):
|
||||||
__tablename__ = "rocketleague"
|
__tablename__ = "rocketleague"
|
||||||
|
|
||||||
|
@ -637,7 +638,10 @@ class Overwatch(Base):
|
||||||
j = r.json()["eu"]["stats"]["quickplay"]["overall_stats"]
|
j = r.json()["eu"]["stats"]["quickplay"]["overall_stats"]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise RequestError("Something went wrong when retrieving the stats.")
|
raise RequestError("Something went wrong when retrieving the stats.")
|
||||||
self.icon = re.search(r"https://.+\.cloudfront\.net/game/unlocks/(0x[0-9A-F]+)\.png", j["avatar"]).group(1)
|
try:
|
||||||
|
self.icon = re.search(r"https://.+\.cloudfront\.net/game/unlocks/(0x[0-9A-F]+)\.png", j["avatar"]).group(1)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
self.level = j["prestige"] * 100 + j["level"]
|
self.level = j["prestige"] * 100 + j["level"]
|
||||||
self.rank = j["comprank"]
|
self.rank = j["comprank"]
|
||||||
|
|
||||||
|
|
16
templates/game.html
Normal file
16
templates/game.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block pagetitle %}
|
||||||
|
{{ game_name }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>
|
||||||
|
Royal Games su {{ game_name }}
|
||||||
|
</h1>
|
||||||
|
{% for mini in minis %}
|
||||||
|
{% with record = mini %}
|
||||||
|
{% include "minis/" + game_short_name + ".html" %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
|
@ -9,27 +9,27 @@
|
||||||
<div class="game-panel">
|
<div class="game-panel">
|
||||||
<div class="game-grid dota">
|
<div class="game-grid dota">
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<a href="https://www.opendota.com/players/{{ dota.steam.to_steam_id_3(dota.steam.steam_id) }}">
|
<a href="https://www.opendota.com/players/{{ record.steam.to_steam_id_3(record.steam.steam_id) }}">
|
||||||
<img src="{{ dota.steam.avatar_url() }}" class="player-image">
|
<img src="{{ record.steam.avatar_url() }}" class="player-image">
|
||||||
<span class="player-name">{{ dota.steam.persona_name }}</span>
|
<span class="player-name">{{ record.steam.persona_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title wins">
|
<div class="game-title wins">
|
||||||
Vittorie
|
Vittorie
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score wins">
|
<div class="game-score wins">
|
||||||
<span>{{ dota.wins }}</span>
|
<span>{{ record.wins }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="rank">
|
<div class="rank">
|
||||||
{% if dota.rank_tier is none %}
|
{% if record.rank_tier is none %}
|
||||||
<img class="medal" src="https://www.opendota.com/assets/images/dota2/rank_icons/rank_icon_0.png">
|
<img class="medal" src="https://www.opendota.com/assets/images/dota2/rank_icons/rank_icon_0.png">
|
||||||
<span class="text">Non classificato</span>
|
<span class="text">Non classificato</span>
|
||||||
{% elif dota.rank_tier < 10 %}
|
{% elif record.rank_tier < 10 %}
|
||||||
<img class="medal" src="https://www.opendota.com/assets/images/dota2/rank_icons/rank_icon_0.png">
|
<img class="medal" src="https://www.opendota.com/assets/images/dota2/rank_icons/rank_icon_0.png">
|
||||||
<span class="text">{{ dota.rank_tier }} piazzamenti completati</span>
|
<span class="text">{{ record.rank_tier }} piazzamenti completati</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img class="medal" src="{{ dota.get_rank_icon_url() }}">{% if dota.get_rank_stars_url() %}<img class="stars" src="{{ dota.get_rank_stars_url() }}">{% endif %}
|
<img class="medal" src="{{ record.get_rank_icon_url() }}">{% if record.get_rank_stars_url() %}<img class="stars" src="{{ record.get_rank_stars_url() }}">{% endif %}
|
||||||
<span class="text">{{ dota.get_rank_name() }}[{{ dota.get_rank_number() }}]</span>
|
<span class="text">{{ record.get_rank_name() }}[{{ record.get_rank_number() }}]</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,49 +1,49 @@
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "BeaufortLoL";
|
font-family: "BeaufortLoL";
|
||||||
src: url("{{ url_for('static', filename='beaufortlol.woff') }}") format('woff');
|
src: url("{{ url_for('static', filename='beaufortrecord.woff') }}") format('woff');
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="game-panel">
|
<div class="game-panel">
|
||||||
<div class="game-grid lol">
|
<div class="game-grid lol">
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<img src="http://avatar.leagueoflegends.com/EUW1/{{ lol.summoner_name }}.png" class="player-image">
|
<img src="http://avatar.leagueoflegends.com/EUW1/{{ record.summoner_name }}.png" class="player-image">
|
||||||
<span class="player-name">{{ lol.summoner_name }}</span>
|
<span class="player-name">{{ record.summoner_name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title level">
|
<div class="game-title level">
|
||||||
LIVELLO
|
LIVELLO
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score level">
|
<div class="game-score level">
|
||||||
<span>{{ lol.level }}</span>
|
<span>{{ record.level }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title soloq">
|
<div class="game-title soloq">
|
||||||
SOLO/DUO
|
SOLO/DUO
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score soloq">
|
<div class="game-score soloq">
|
||||||
{% if lol.solo_division is none %}
|
{% if record.solo_division is none %}
|
||||||
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
|
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ url_for('static', filename='lol-rank-icons/' + lol.solo_division.name|lower + "_" + lol.solo_rank.name|lower + ".png") }}" class="rank" title="{{ lol.solo_division.name|capitalize }} {{ lol.solo_rank.name }}">
|
<img src="{{ url_for('static', filename='lol-rank-icons/' + record.solo_division.name|lower + "_" + record.solo_rank.name|lower + ".png") }}" class="rank" title="{{ record.solo_division.name|capitalize }} {{ record.solo_rank.name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title flexq">
|
<div class="game-title flexq">
|
||||||
FLEX
|
FLEX
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score flexq">
|
<div class="game-score flexq">
|
||||||
{% if lol.flex_division is none %}
|
{% if record.flex_division is none %}
|
||||||
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
|
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ url_for('static', filename='lol-rank-icons/' + lol.flex_division.name|lower + "_" + lol.flex_rank.name|lower + ".png") }}" class="rank" title="{{ lol.flex_division.name|capitalize }} {{ lol.flex_rank.name }}">
|
<img src="{{ url_for('static', filename='lol-rank-icons/' + record.flex_division.name|lower + "_" + record.flex_rank.name|lower + ".png") }}" class="rank" title="{{ record.flex_division.name|capitalize }} {{ record.flex_rank.name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title twtrq">
|
<div class="game-title twtrq">
|
||||||
3V3
|
3V3
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score twtrq">
|
<div class="game-score twtrq">
|
||||||
{% if lol.twtr_division is none %}
|
{% if record.twtr_division is none %}
|
||||||
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
|
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ url_for('static', filename='lol-rank-icons/' + lol.twtr_division.name|lower + "_" + lol.twtr_rank.name|lower + ".png") }}" class="rank" title="{{ lol.twtr_division.name|capitalize }} {{ lol.twtr_rank.name }}">
|
<img src="{{ url_for('static', filename='lol-rank-icons/' + record.twtr_division.name|lower + "_" + record.twtr_rank.name|lower + ".png") }}" class="rank" title="{{ record.twtr_division.name|capitalize }} {{ record.twtr_rank.name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,34 +3,34 @@
|
||||||
<div class="background-image"></div>
|
<div class="background-image"></div>
|
||||||
<div class="background-color"></div>
|
<div class="background-color"></div>
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<a href="https://osu.ppy.sh/users/{{ osu.osu_id }}">
|
<a href="https://record.ppy.sh/users/{{ record.osu_id }}">
|
||||||
<img src="https://a.ppy.sh/{{ osu.osu_id }}" class="player-image">
|
<img src="https://a.ppy.sh/{{ record.osu_id }}" class="player-image">
|
||||||
<span class="player-name">{{ osu.osu_name }}</span>
|
<span class="player-name">{{ record.osu_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title standard">
|
<div class="game-title standard">
|
||||||
osu!
|
osu!
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score standard">
|
<div class="game-score standard">
|
||||||
<span class="number">{{ osu.std_pp | int }}</span><span class="pp">pp</span>
|
<span class="number">{{ record.std_pp | int }}</span><span class="pp">pp</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title taiko">
|
<div class="game-title taiko">
|
||||||
osu!taiko
|
osu!taiko
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score taiko">
|
<div class="game-score taiko">
|
||||||
<span class="number">{{ osu.taiko_pp | int }}</span><span class="pp">pp</span>
|
<span class="number">{{ record.taiko_pp | int }}</span><span class="pp">pp</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title catch">
|
<div class="game-title catch">
|
||||||
osu!catch
|
osu!catch
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score catch">
|
<div class="game-score catch">
|
||||||
<span class="number">{{ osu.catch_pp | int }}</span><span class="pp">pp</span>
|
<span class="number">{{ record.catch_pp | int }}</span><span class="pp">pp</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title mania">
|
<div class="game-title mania">
|
||||||
osu!mania
|
osu!mania
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score mania">
|
<div class="game-score mania">
|
||||||
<span class="number">{{ osu.mania_pp | int }}</span><span class="pp">pp</span>
|
<span class="number">{{ record.mania_pp | int }}</span><span class="pp">pp</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -9,24 +9,24 @@
|
||||||
<div class="game-panel">
|
<div class="game-panel">
|
||||||
<div class="game-grid ow">
|
<div class="game-grid ow">
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<a href="https://playoverwatch.com/en-us/career/pc/eu/{{ ow.__str__(separator='-') }}">
|
<a href="https://playoverwatch.com/en-us/career/pc/eu/{{ record.__str__(separator='-') }}">
|
||||||
<img src="{{ ow.icon_url() }}" class="player-image">
|
<img src="{{ record.icon_url() }}" class="player-image">
|
||||||
<span class="player-name">{{ ow }}</span>
|
<span class="player-name">{{ record }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title level">
|
<div class="game-title level">
|
||||||
Livello
|
Livello
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score level">
|
<div class="game-score level">
|
||||||
<span>{{ ow.level }}</span>
|
<span>{{ record.level }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="rank">
|
<div class="rank">
|
||||||
{% if ow.rank is none %}
|
{% if record.rank is none %}
|
||||||
<div class="icon unranked"></div>
|
<div class="icon unranked"></div>
|
||||||
<span class="text unranked">Non classificato</span>
|
<span class="text unranked">Non classificato</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img class="icon ranked" src="{{ ow.rank_url() }}">
|
<img class="icon ranked" src="{{ record.rank_url() }}">
|
||||||
<span class="text ranked">{{ ow.rank }}</span>
|
<span class="text ranked">{{ record.rank }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,34 +4,34 @@
|
||||||
<div class="game-panel">
|
<div class="game-panel">
|
||||||
<div class="game-grid rl">
|
<div class="game-grid rl">
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<a href="https://rocketleaguestats.com/profile/steam/{{ rl.steam.steam_id }}">
|
<a href="https://rocketleaguestats.com/profile/steam/{{ record.steam.steam_id }}">
|
||||||
<img src="{{ rl.steam.avatar_url() }}" class="player-image">
|
<img src="{{ record.steam.avatar_url() }}" class="player-image">
|
||||||
<span class="player-name">{{ rl.steam.persona_name }}</span>
|
<span class="player-name">{{ record.steam.persona_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title duel">
|
<div class="game-title duel">
|
||||||
DUELLO
|
DUELLO
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score duel">
|
<div class="game-score duel">
|
||||||
<img src="{{ rl.solo_rank_image() }}" title="{{ rl.single_mmr }} MMR">
|
<img src="{{ record.solo_rank_image() }}" title="{{ record.single_mmr }} MMR">
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title doubles">
|
<div class="game-title doubles">
|
||||||
DOPPIO
|
DOPPIO
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score doubles">
|
<div class="game-score doubles">
|
||||||
<img src="{{ rl.doubles_rank_image() }}" title="{{ rl.doubles_mmr }} MMR">
|
<img src="{{ record.doubles_rank_image() }}" title="{{ record.doubles_mmr }} MMR">
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title standard">
|
<div class="game-title standard">
|
||||||
STANDARD
|
STANDARD
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score standard">
|
<div class="game-score standard">
|
||||||
<img src="{{ rl.standard_rank_image() }}" title="{{ rl.standard_mmr }} MMR">
|
<img src="{{ record.standard_rank_image() }}" title="{{ record.standard_mmr }} MMR">
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title solostd">
|
<div class="game-title solostd">
|
||||||
SOLO STD
|
SOLO STD
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score solostd">
|
<div class="game-score solostd">
|
||||||
<img src="{{ rl.solo_std_rank_image() }}" title="{{ rl.solo_std_mmr }} MMR">
|
<img src="{{ record.solo_std_rank_image() }}" title="{{ record.solo_std_mmr }} MMR">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,16 +1,16 @@
|
||||||
<div class="game-panel">
|
<div class="game-panel">
|
||||||
<div class="game-grid ryg">
|
<div class="game-grid ryg">
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<span class="player-name">{{ royal.username }}</span>
|
<span class="player-name">{{ record.username }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-status">
|
<div class="member-status">
|
||||||
<span class="role">{{ royal.role }}</span> dal <span class="member-since">{% if royal.member_since %}{{ royal.member_since }}{% else %}????-??-??{% endif %}</span>
|
<span class="role">{{ record.role }}</span> dal <span class="member-since">{% if record.member_since %}{{ record.member_since }}{% else %}????-??-??{% endif %}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="game-title fiorygi">
|
<div class="game-title fiorygi">
|
||||||
Fiorygi
|
Fiorygi
|
||||||
</div>
|
</div>
|
||||||
<div class="game-score fiorygi">
|
<div class="game-score fiorygi">
|
||||||
{{ royal.fiorygi }}
|
{{ record.fiorygi }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -5,39 +5,39 @@
|
||||||
<div class="game-panel">
|
<div class="game-panel">
|
||||||
<div class="game-grid steam">
|
<div class="game-grid steam">
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<a href="http://steamcommunity.com/profiles/{{ steam.steam_id }}">
|
<a href="http://steamcommunity.com/profiles/{{ record.steam_id }}">
|
||||||
<img src="{{ steam.avatar_url() }}" class="player-image">
|
<img src="{{ record.avatar_url() }}" class="player-image">
|
||||||
<span class="player-name">{{ steam.persona_name }}</span>
|
<span class="player-name">{{ record.persona_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a href="steam://friends/add/{{ steam.steam_id }}">
|
<a href="steam://friends/add/{{ record.steam_id }}">
|
||||||
<div class="button add-friend-button">
|
<div class="button add-friend-button">
|
||||||
<i class="fas fa-user-plus"></i>
|
<i class="fas fa-user-plus"></i>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="steam://friends/message/{{ steam.steam_id }}">
|
<a href="steam://friends/message/{{ record.steam_id }}">
|
||||||
<div class="button message-button">
|
<div class="button message-button">
|
||||||
<i class="fas fa-comment-alt"></i>
|
<i class="fas fa-comment-alt"></i>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://steamdb.info/calculator/{{ steam.steam_id }}" target="_blank">
|
<a href="https://steamdb.info/calculator/{{ record.steam_id }}" target="_blank">
|
||||||
<div class="button calculator-button">
|
<div class="button calculator-button">
|
||||||
<i class="fas fa-calculator"></i>
|
<i class="fas fa-calculator"></i>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% if steam.trade_token %}
|
{% if record.trade_token %}
|
||||||
<a href="{{ steam.trade_token }}" target="_blank">
|
<a href="{{ record.trade_token }}" target="_blank">
|
||||||
<div class="button trade-button">
|
<div class="button trade-button">
|
||||||
<i class="fas fa-handshake"></i>
|
<i class="fas fa-handshake"></i>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if steam.most_played_game_id %}
|
{% if record.most_played_game_id %}
|
||||||
<a href="https://store.steampowered.com/app/{{ steam.most_played_game_id }}/">
|
<a href="https://store.steampowered.com/app/{{ record.most_played_game_id }}/">
|
||||||
<div class="game-banner">
|
<div class="game-banner">
|
||||||
<img src="https://steamcdn-a.akamaihd.net/steam/apps/{{ steam.most_played_game_id }}/header.jpg">
|
<img src="https://steamcdn-a.akamaihd.net/steam/apps/{{ record.most_played_game_id }}/header.jpg">
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -20,21 +20,33 @@
|
||||||
</h1>
|
</h1>
|
||||||
{% include "minis/ryg.html" %}
|
{% include "minis/ryg.html" %}
|
||||||
{% if steam %}
|
{% if steam %}
|
||||||
{% include "minis/steam.html" %}
|
{% with record = steam %}
|
||||||
|
{% include "minis/steam.html" %}
|
||||||
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rl %}
|
{% if rl %}
|
||||||
{% include "minis/rl.html" %}
|
{% with record = rl %}
|
||||||
|
{% include "minis/rl.html" %}
|
||||||
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if dota %}
|
{% if dota %}
|
||||||
{% include "minis/dota.html" %}
|
{% with record = dota %}
|
||||||
|
{% include "minis/dota.html" %}
|
||||||
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if osu %}
|
{% if osu %}
|
||||||
{% include "minis/osu.html" %}
|
{% with record = osu %}
|
||||||
|
{% include "minis/osu.html" %}
|
||||||
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if lol %}
|
{% if lol %}
|
||||||
{% include "minis/lol.html" %}
|
{% with record = lol %}
|
||||||
|
{% include "minis/lol.html" %}
|
||||||
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ow %}
|
{% if ow %}
|
||||||
{% include "minis/ow.html" %}
|
{% with record = ow %}
|
||||||
|
{% include "minis/ow.html" %}
|
||||||
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
158
update.py
158
update.py
|
@ -8,85 +8,85 @@ try:
|
||||||
while True:
|
while True:
|
||||||
session = db.Session()
|
session = db.Session()
|
||||||
# Update Steam
|
# Update Steam
|
||||||
print("STEAM")
|
#print("STEAM")
|
||||||
for user in session.query(db.Steam).all():
|
#for user in session.query(db.Steam).all():
|
||||||
t = time.clock()
|
# t = time.clock()
|
||||||
print(f"Updating {user.royal.username}", end="\t\t", flush=True)
|
# print(f"Updating {user.royal.username}", end="\t\t", flush=True)
|
||||||
try:
|
# try:
|
||||||
user.update()
|
# user.update()
|
||||||
except errors.RequestError:
|
# except errors.RequestError:
|
||||||
print("Request Error")
|
# print("Request Error")
|
||||||
except errors.NotFoundError:
|
# except errors.NotFoundError:
|
||||||
print("Not Found Error (?)")
|
# print("Not Found Error (?)")
|
||||||
else:
|
# else:
|
||||||
print("OK")
|
# print("OK")
|
||||||
finally:
|
# finally:
|
||||||
sleep_time = 1 - time.clock() + t
|
# sleep_time = 1 - time.clock() + t
|
||||||
time.sleep(sleep_time if sleep_time > 0 else 0)
|
# time.sleep(sleep_time if sleep_time > 0 else 0)
|
||||||
# Update Rocket League
|
## Update Rocket League
|
||||||
print("ROCKET LEAGUE")
|
#print("ROCKET LEAGUE")
|
||||||
for user in session.query(db.RocketLeague).all():
|
#for user in session.query(db.RocketLeague).all():
|
||||||
t = time.clock()
|
# t = time.clock()
|
||||||
print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True)
|
# print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True)
|
||||||
try:
|
# try:
|
||||||
user.update()
|
# user.update()
|
||||||
except errors.RequestError:
|
# except errors.RequestError:
|
||||||
print("Request Error")
|
# print("Request Error")
|
||||||
except errors.NotFoundError:
|
# except errors.NotFoundError:
|
||||||
print("Not Found Error (?)")
|
# print("Not Found Error (?)")
|
||||||
else:
|
# else:
|
||||||
print("OK")
|
# print("OK")
|
||||||
finally:
|
# finally:
|
||||||
sleep_time = 1 - time.clock() + t
|
# sleep_time = 1 - time.clock() + t
|
||||||
time.sleep(sleep_time if sleep_time > 0 else 0)
|
# time.sleep(sleep_time if sleep_time > 0 else 0)
|
||||||
# Update Dota 2
|
## Update Dota 2
|
||||||
print("DOTA 2")
|
#print("DOTA 2")
|
||||||
for user in session.query(db.Dota).all():
|
#for user in session.query(db.Dota).all():
|
||||||
t = time.clock()
|
# t = time.clock()
|
||||||
print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True)
|
# print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True)
|
||||||
try:
|
# try:
|
||||||
user.update()
|
# user.update()
|
||||||
except errors.RequestError:
|
# except errors.RequestError:
|
||||||
print("Request Error")
|
# print("Request Error")
|
||||||
except errors.NotFoundError:
|
# except errors.NotFoundError:
|
||||||
print("Not Found Error (?)")
|
# print("Not Found Error (?)")
|
||||||
else:
|
# else:
|
||||||
print("OK")
|
# print("OK")
|
||||||
finally:
|
# finally:
|
||||||
sleep_time = 1 - time.clock() + t
|
# sleep_time = 1 - time.clock() + t
|
||||||
time.sleep(sleep_time if sleep_time > 0 else 0)
|
# time.sleep(sleep_time if sleep_time > 0 else 0)
|
||||||
# Update League of Legends
|
## Update League of Legends
|
||||||
print("LEAGUE OF LEGENDS")
|
#print("LEAGUE OF LEGENDS")
|
||||||
for user in session.query(db.LeagueOfLegends).all():
|
#for user in session.query(db.LeagueOfLegends).all():
|
||||||
t = time.clock()
|
# t = time.clock()
|
||||||
print(f"Updating {user.royal.username}", end="\t\t", flush=True)
|
# print(f"Updating {user.royal.username}", end="\t\t", flush=True)
|
||||||
try:
|
# try:
|
||||||
user.update()
|
# user.update()
|
||||||
except errors.RequestError:
|
# except errors.RequestError:
|
||||||
print("Request Error")
|
# print("Request Error")
|
||||||
except errors.NotFoundError:
|
# except errors.NotFoundError:
|
||||||
print("Not Found Error (?)")
|
# print("Not Found Error (?)")
|
||||||
else:
|
# else:
|
||||||
print("OK")
|
# print("OK")
|
||||||
finally:
|
# finally:
|
||||||
sleep_time = 1 - time.clock() + t
|
# sleep_time = 1 - time.clock() + t
|
||||||
time.sleep(sleep_time if sleep_time > 0 else 0)
|
# time.sleep(sleep_time if sleep_time > 0 else 0)
|
||||||
# Update Osu!
|
## Update Osu!
|
||||||
print("OSU!")
|
#print("OSU!")
|
||||||
for user in session.query(db.Osu).all():
|
#for user in session.query(db.Osu).all():
|
||||||
t = time.clock()
|
# t = time.clock()
|
||||||
print(f"Updating {user.royal.username}", end="\t\t", flush=True)
|
# print(f"Updating {user.royal.username}", end="\t\t", flush=True)
|
||||||
try:
|
# try:
|
||||||
user.update()
|
# user.update()
|
||||||
except errors.RequestError:
|
# except errors.RequestError:
|
||||||
print("Request Error")
|
# print("Request Error")
|
||||||
except errors.NotFoundError:
|
# except errors.NotFoundError:
|
||||||
print("Not Found Error (?)")
|
# print("Not Found Error (?)")
|
||||||
else:
|
# else:
|
||||||
print("OK")
|
# print("OK")
|
||||||
finally:
|
# finally:
|
||||||
sleep_time = 1 - time.clock() + t
|
# sleep_time = 1 - time.clock() + t
|
||||||
time.sleep(sleep_time if sleep_time > 0 else 0)
|
# time.sleep(sleep_time if sleep_time > 0 else 0)
|
||||||
# Update Overwatch
|
# Update Overwatch
|
||||||
print("OVERWATCH")
|
print("OVERWATCH")
|
||||||
for user in session.query(db.Overwatch).all():
|
for user in session.query(db.Overwatch).all():
|
||||||
|
|
27
webserver.py
27
webserver.py
|
@ -123,6 +123,33 @@ def page_setcss():
|
||||||
return redirect(url_for("page_profile", name=royal.username))
|
return redirect(url_for("page_profile", name=royal.username))
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/game/<name>")
|
||||||
|
def page_game(name: str):
|
||||||
|
db_session = db.Session()
|
||||||
|
if name == "rl":
|
||||||
|
game_name = "Rocket League"
|
||||||
|
query = db_session.query(db.RocketLeague).join(db.Steam).all()
|
||||||
|
elif name == "dota":
|
||||||
|
game_name = "Dota 2"
|
||||||
|
query = db_session.query(db.Dota).join(db.Steam).all()
|
||||||
|
elif name == "lol":
|
||||||
|
game_name = "League of Legends"
|
||||||
|
query = db_session.query(db.LeagueOfLegends).all()
|
||||||
|
elif name == "osu":
|
||||||
|
game_name = "osu!"
|
||||||
|
query = db_session.query(db.Osu).all()
|
||||||
|
elif name == "ow":
|
||||||
|
game_name = "Overwatch"
|
||||||
|
query = db_session.query(db.Overwatch).all()
|
||||||
|
elif name == "steam":
|
||||||
|
game_name = "Steam"
|
||||||
|
query = db_session.query(db.Steam).all()
|
||||||
|
elif name == "ryg":
|
||||||
|
game_name = "Royalnet"
|
||||||
|
query = db_session.query(db.Royal).all()
|
||||||
|
db_session.close()
|
||||||
|
return render_template("game.html", minis=query, game_name=game_name, game_short_name=name)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
app.run(host="0.0.0.0", port=1234, debug=__debug__)
|
app.run(host="0.0.0.0", port=1234, debug=__debug__)
|
||||||
|
|
Loading…
Reference in a new issue