mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
New profile stuff
This commit is contained in:
parent
117d2404df
commit
629317996b
9 changed files with 249 additions and 174 deletions
18
db.py
18
db.py
|
@ -92,9 +92,10 @@ class Steam(Base):
|
||||||
royal = relationship("Royal", lazy="joined")
|
royal = relationship("Royal", lazy="joined")
|
||||||
|
|
||||||
steam_id = Column(String, primary_key=True)
|
steam_id = Column(String, primary_key=True)
|
||||||
persona_name = Column(String, nullable=False)
|
persona_name = Column(String)
|
||||||
avatar_hex = Column(String, nullable=False)
|
avatar_hex = Column(String)
|
||||||
trade_token = Column(String)
|
trade_token = Column(String)
|
||||||
|
most_played_game_id = Column(BigInteger)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Steam {self.steam_id}>"
|
return f"<Steam {self.steam_id}>"
|
||||||
|
@ -105,6 +106,9 @@ class Steam(Base):
|
||||||
else:
|
else:
|
||||||
return self.steam_id
|
return self.steam_id
|
||||||
|
|
||||||
|
def most_played_game_url(self):
|
||||||
|
return f"https://steamcdn-a.akamaihd.net/steam/apps/{self.most_played_game_id}/header.jpg"
|
||||||
|
|
||||||
def avatar_url(self):
|
def avatar_url(self):
|
||||||
return f"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/{self.avatar_hex[0:2]}/{self.avatar_hex}.jpg"
|
return f"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/{self.avatar_hex[0:2]}/{self.avatar_hex}.jpg"
|
||||||
|
|
||||||
|
@ -151,7 +155,15 @@ class Steam(Base):
|
||||||
j = r.json()
|
j = r.json()
|
||||||
self.persona_name = j["response"]["players"][0]["personaname"]
|
self.persona_name = j["response"]["players"][0]["personaname"]
|
||||||
self.avatar_hex = re.search(r"https://steamcdn-a\.akamaihd\.net/steamcommunity/public/images/avatars/../(.+).jpg", j["response"]["players"][0]["avatar"]).group(1)
|
self.avatar_hex = re.search(r"https://steamcdn-a\.akamaihd\.net/steamcommunity/public/images/avatars/../(.+).jpg", j["response"]["players"][0]["avatar"]).group(1)
|
||||||
|
r = requests.get(f"http://api.steampowered.com/IPlayerService/GetRecentlyPlayedGames/v0001/?key={config['Steam']['api_key']}&steamid={self.steam_id}&format=json")
|
||||||
|
if r.status_code != 200:
|
||||||
|
raise RequestError(f"Steam returned {r.status_code}")
|
||||||
|
j = r.json()
|
||||||
|
if "response" not in j \
|
||||||
|
or "games" not in j["response"] \
|
||||||
|
or len(j["response"]["games"]) < 1:
|
||||||
|
raise RequestError(f"Game data is private")
|
||||||
|
self.most_played_game_id = j["response"]["games"][0]["appid"]
|
||||||
|
|
||||||
class RocketLeague(Base):
|
class RocketLeague(Base):
|
||||||
__tablename__ = "rocketleague"
|
__tablename__ = "rocketleague"
|
||||||
|
|
150
static/nryg.less
150
static/nryg.less
|
@ -48,6 +48,30 @@ input[type="text"], input[type="password"] {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
.game-title {
|
||||||
|
grid-row: 2;
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
.game-score {
|
||||||
|
grid-row: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player {
|
||||||
|
grid-row: 1;
|
||||||
|
font-size: large;
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-image {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.osu {
|
.osu {
|
||||||
|
@ -82,17 +106,9 @@ input[type="text"], input[type="password"] {
|
||||||
grid-row: 1;
|
grid-row: 1;
|
||||||
grid-column-start: 1;
|
grid-column-start: 1;
|
||||||
grid-column-end: 4;
|
grid-column-end: 4;
|
||||||
font-size: large;
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-image {
|
.player-image {
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
vertical-align: middle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-name {
|
.player-name {
|
||||||
|
@ -101,15 +117,9 @@ input[type="text"], input[type="password"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
.game-title {
|
.game-title {
|
||||||
grid-row: 2;
|
|
||||||
font-size: smaller;
|
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.game-score {
|
|
||||||
grid-row: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.standard {
|
.standard {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
}
|
}
|
||||||
|
@ -145,40 +155,22 @@ input[type="text"], input[type="password"] {
|
||||||
grid-row: 1;
|
grid-row: 1;
|
||||||
grid-column-start: 1;
|
grid-column-start: 1;
|
||||||
grid-column-end: 4;
|
grid-column-end: 4;
|
||||||
font-size: large;
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-image {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-name {
|
.player-name {
|
||||||
vertical-align: middle;
|
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.game-title {
|
.game-title {
|
||||||
grid-row: 2;
|
|
||||||
font-size: smaller;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #41abfa;
|
color: #41abfa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.game-score {
|
.game-score img {
|
||||||
grid-row: 3;
|
|
||||||
|
|
||||||
img {
|
|
||||||
height: 36px;
|
height: 36px;
|
||||||
display: block;
|
display: block;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.duel {
|
.duel {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
@ -210,30 +202,13 @@ input[type="text"], input[type="password"] {
|
||||||
grid-row: 1;
|
grid-row: 1;
|
||||||
grid-column-start: 1;
|
grid-column-start: 1;
|
||||||
grid-column-end: 3;
|
grid-column-end: 3;
|
||||||
font-size: large;
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-image {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-name {
|
.player-name {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.game-score.wins {
|
||||||
grid-row: 2;
|
|
||||||
font-size: x-small;
|
|
||||||
}
|
|
||||||
|
|
||||||
.number {
|
|
||||||
grid-row: 3;
|
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,10 +217,6 @@ input[type="text"], input[type="password"] {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wins.number {
|
|
||||||
color: #ffb600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rank {
|
.rank {
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
grid-row-start: 2;
|
grid-row-start: 2;
|
||||||
|
@ -283,22 +254,17 @@ input[type="text"], input[type="password"] {
|
||||||
grid-row: 1;
|
grid-row: 1;
|
||||||
grid-column-start: 1;
|
grid-column-start: 1;
|
||||||
grid-column-end: 4;
|
grid-column-end: 4;
|
||||||
font-size: large;
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-image {
|
.player-image {
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
vertical-align: middle;
|
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.level {
|
.level {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.game-score.level {
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,14 +280,11 @@ input[type="text"], input[type="password"] {
|
||||||
grid-column: 4;
|
grid-column: 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.game-title {
|
||||||
grid-row: 2;
|
|
||||||
font-size: x-small;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.game-score {
|
||||||
grid-row: 3;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
@ -330,3 +293,54 @@ input[type="text"], input[type="password"] {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.steam {
|
||||||
|
font-family: "Motiva Sans", sans-serif;
|
||||||
|
padding: 18px;
|
||||||
|
background: url("https://steamstore-a.akamaihd.net/public/images/v6/colored_body_top2.png?v=2") center;
|
||||||
|
|
||||||
|
.player .player-name {
|
||||||
|
grid-row: 1;
|
||||||
|
grid-column: 1;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons {
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column-start: 1;
|
||||||
|
grid-column-end: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.game-banner {
|
||||||
|
grid-row: 1;
|
||||||
|
grid-column: 2;
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
img {
|
||||||
|
height: 58px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
background-color: rgba(0,0,0,0.4);
|
||||||
|
color: #9e9d9b;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 4px;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover, .button:active {
|
||||||
|
background-color: rgba(102,192,244,0.4);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
<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="http://steamcommunity.com/profiles/{{ dota.steam.steam_id }}">
|
<a href="https://www.opendota.com/players/{{ dota.steam.to_steam_id_3(dota.steam.steam_id) }}">
|
||||||
<img src="{{ dota.steam.avatar_url() }}" class="player-image">
|
<img src="{{ dota.steam.avatar_url() }}" class="player-image">
|
||||||
<span class="player-name">{{ dota.steam.persona_name }}</span>
|
<span class="player-name">{{ dota.steam.persona_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="title wins">
|
<div class="game-title wins">
|
||||||
Vittorie
|
Vittorie
|
||||||
</div>
|
</div>
|
||||||
<div class="number wins">
|
<div class="game-score wins">
|
||||||
<span>{{ dota.wins }}</span>
|
<span>{{ dota.wins }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="rank">
|
<div class="rank">
|
||||||
|
|
|
@ -10,40 +10,40 @@
|
||||||
<img src="http://avatar.leagueoflegends.com/EUW1/{{ lol.summoner_name }}.png" class="player-image">
|
<img src="http://avatar.leagueoflegends.com/EUW1/{{ lol.summoner_name }}.png" class="player-image">
|
||||||
<span class="player-name">{{ lol.summoner_name }}</span>
|
<span class="player-name">{{ lol.summoner_name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="title level">
|
<div class="game-title level">
|
||||||
LIVELLO
|
LIVELLO
|
||||||
</div>
|
</div>
|
||||||
<div class="value level">
|
<div class="game-score level">
|
||||||
<span>{{ lol.level }}</span>
|
<span>{{ lol.level }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="title soloq">
|
<div class="game-title soloq">
|
||||||
SOLO/DUO
|
SOLO/DUO
|
||||||
</div>
|
</div>
|
||||||
<div class="value soloq">
|
<div class="game-score soloq">
|
||||||
{% if lol.solo_division is none %}
|
{% if lol.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') }}" game-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/' + lol.solo_division.name|lower + "_" + lol.solo_rank.name|lower + ".png") }}" class="rank" game-title="{{ lol.solo_division.name|capitalize }} {{ lol.solo_rank.name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="title flexq">
|
<div class="game-title flexq">
|
||||||
FLEX
|
FLEX
|
||||||
</div>
|
</div>
|
||||||
<div class="value flexq">
|
<div class="game-score flexq">
|
||||||
{% if lol.flex_division is none %}
|
{% if lol.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') }}" game-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/' + lol.flex_division.name|lower + "_" + lol.flex_rank.name|lower + ".png") }}" class="rank" game-title="{{ lol.flex_division.name|capitalize }} {{ lol.flex_rank.name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="title twtrq">
|
<div class="game-title twtrq">
|
||||||
3V3
|
3V3
|
||||||
</div>
|
</div>
|
||||||
<div class="value twtrq">
|
<div class="game-score twtrq">
|
||||||
{% if lol.twtr_division is none %}
|
{% if lol.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') }}" game-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/' + lol.twtr_division.name|lower + "_" + lol.twtr_rank.name|lower + ".png") }}" class="rank" game-title="{{ lol.twtr_division.name|capitalize }} {{ lol.twtr_rank.name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<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="http://steamcommunity.com/profiles/{{ rl.steam.steam_id }}">
|
<a href="https://rocketleaguestats.com/profile/steam/{{ rl.steam.steam_id }}">
|
||||||
<img src="{{ rl.steam.avatar_url() }}" class="player-image">
|
<img src="{{ rl.steam.avatar_url() }}" class="player-image">
|
||||||
<span class="player-name">{{ rl.steam.persona_name }}</span>
|
<span class="player-name">{{ rl.steam.persona_name }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
45
templates/minis/steam.html
Normal file
45
templates/minis/steam.html
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
|
||||||
|
<style>
|
||||||
|
@font-face { font-family: "Motiva Sans"; src: url("https://steamcommunity-a.akamaihd.net/public/shared/fonts/MotivaSans-Regular.ttf") format("truetype"); font-style: normal; font-weight: normal; }
|
||||||
|
</style>
|
||||||
|
<div class="game-panel">
|
||||||
|
<div class="game-grid steam">
|
||||||
|
<div class="player">
|
||||||
|
<a href="http://steamcommunity.com/profiles/{{ steam.steam_id }}">
|
||||||
|
<img src="{{ steam.avatar_url() }}" class="player-image">
|
||||||
|
<span class="player-name">{{ steam.persona_name }}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<a href="steam://friends/add/{{ steam.steam_id }}">
|
||||||
|
<div class="button add-friend-button">
|
||||||
|
<i class="fas fa-user-plus"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<a href="steam://friends/message/{{ steam.steam_id }}">
|
||||||
|
<div class="button message-button">
|
||||||
|
<i class="fas fa-comment-alt"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<a href="https://steamdb.info/calculator/{{ steam.steam_id }}" target="_blank">
|
||||||
|
<div class="button calculator-button">
|
||||||
|
<i class="fas fa-calculator"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% if steam.trade_token %}
|
||||||
|
<a href="{{ steam.trade_token }}" target="_blank">
|
||||||
|
<div class="button trade-button">
|
||||||
|
<i class="fas fa-handshake"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% if steam.most_played_game_id %}
|
||||||
|
<a href="https://store.steampowered.com/app/{{ steam.most_played_game_id }}/">
|
||||||
|
<div class="game-banner">
|
||||||
|
<img src="https://steamcdn-a.akamaihd.net/steam/apps/{{ steam.most_played_game_id }}/header.jpg">
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -8,8 +8,8 @@
|
||||||
<h1>
|
<h1>
|
||||||
Profilo di {{ royal.username }}
|
Profilo di {{ royal.username }}
|
||||||
</h1>
|
</h1>
|
||||||
{% if osu %}
|
{% if steam %}
|
||||||
{% include "minis/osu.html" %}
|
{% include "minis/steam.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rl %}
|
{% if rl %}
|
||||||
{% include "minis/rl.html" %}
|
{% include "minis/rl.html" %}
|
||||||
|
@ -17,6 +17,9 @@
|
||||||
{% if dota %}
|
{% if dota %}
|
||||||
{% include "minis/dota.html" %}
|
{% include "minis/dota.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if osu %}
|
||||||
|
{% include "minis/osu.html" %}
|
||||||
|
{% endif %}
|
||||||
{% if lol %}
|
{% if lol %}
|
||||||
{% include "minis/lol.html" %}
|
{% include "minis/lol.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
158
update.py
158
update.py
|
@ -22,85 +22,85 @@ try:
|
||||||
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():
|
||||||
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)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -32,12 +32,13 @@ def page_profile(name: str):
|
||||||
db_session.close()
|
db_session.close()
|
||||||
abort(404)
|
abort(404)
|
||||||
return
|
return
|
||||||
|
steam = db_session.query(db.Steam).filter_by(royal=user).one_or_none()
|
||||||
osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none()
|
osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none()
|
||||||
rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none()
|
rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none()
|
||||||
dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none()
|
dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none()
|
||||||
lol = db_session.query(db.LeagueOfLegends).filter_by(royal=user).one_or_none()
|
lol = db_session.query(db.LeagueOfLegends).filter_by(royal=user).one_or_none()
|
||||||
db_session.close()
|
db_session.close()
|
||||||
return render_template("profile.html", royal=user, osu=osu, rl=rl, dota=dota, lol=lol)
|
return render_template("profile.html", royal=user, osu=osu, rl=rl, dota=dota, lol=lol, steam=steam)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/login")
|
@app.route("/login")
|
||||||
|
|
Loading…
Reference in a new issue