diff --git a/db.py b/db.py index 957ef5e3..211df08d 100644 --- a/db.py +++ b/db.py @@ -21,7 +21,6 @@ Session = sessionmaker(bind=engine) # Create a new default session session = Session() - class Royal(Base): __tablename__ = "royals" @@ -82,6 +81,9 @@ class Steam(Base): else: return self.steam_id + def avatar_url(self): + return f"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/{self.avatar_hex[0:2]}/{self.avatar_hex}.jpg" + @staticmethod def get_or_create(royal_id, steam_id): s = session.query(Steam).get(steam_id) @@ -505,6 +507,9 @@ class Overwatch(Base): rank=j["comprank"]) return o + def icon_url(self): + return f"https://d1u1mce87gyfbn.cloudfront.net/game/unlocks/{self.icon}.png" + def update(self): r = requests.get(f"https://owapi.net/api/v3/u/{self.battletag}-{self.discriminator}/stats", headers={ "User-Agent": "Royal-Bot/4.0", @@ -558,4 +563,5 @@ class Diario(Base): # If run as script, create all the tables in the db if __name__ == "__main__": - Base.metadata.create_all(bind=engine) \ No newline at end of file + Base.metadata.create_all(bind=engine) + session.close() \ No newline at end of file diff --git a/newuser.py b/newuser.py index 287e2482..6c0d1589 100644 --- a/newuser.py +++ b/newuser.py @@ -1,45 +1,43 @@ import db -session = db.Session() - -while True: - user = db.Royal.get_or_create(input("Nome account: ")) - session.add(user) - session.commit() - try: - steam = db.Steam.get_or_create(user.id, input("Steam ID 1: ")) - except KeyboardInterrupt: - pass - else: - session.add(steam) - try: - dota = db.Dota.get_or_create(steam.steam_id) - except KeyboardInterrupt: - pass - else: - session.add(dota) - try: - rl = db.RocketLeague.get_or_create(steam.steam_id) - except KeyboardInterrupt: - pass - else: - session.add(rl) - try: - osu = db.Osu.get_or_create(user.id, input("Osu! username: ")) - except KeyboardInterrupt: - pass - else: - session.add(osu) - try: - overwatch = db.Overwatch.get_or_create(user.id, input("Battle.net battletag: ")) - except KeyboardInterrupt: - pass - else: - session.add(overwatch) - try: - lol = db.LeagueOfLegends.get_or_create(user.id, input("League summoner name: ")) - except KeyboardInterrupt: - pass - else: - session.add(lol) - session.commit() \ No newline at end of file +user = db.Royal.get_or_create(input("Nome account: ")) +db.session.add(user) +db.session.commit() +try: + steam = db.Steam.get_or_create(user.id, input("Steam ID 1: ")) +except KeyboardInterrupt: + pass +else: + db.session.add(steam) +try: + dota = db.Dota.get_or_create(steam.steam_id) +except KeyboardInterrupt: + pass +else: + db.session.add(dota) +try: + rl = db.RocketLeague.get_or_create(steam.steam_id) +except KeyboardInterrupt: + pass +else: + db.session.add(rl) +try: + osu = db.Osu.get_or_create(user.id, input("Osu! username: ")) +except KeyboardInterrupt: + pass +else: + db.session.add(osu) +try: + overwatch = db.Overwatch.get_or_create(user.id, input("Battle.net battletag: ")) +except KeyboardInterrupt: + pass +else: + db.session.add(overwatch) +try: + lol = db.LeagueOfLegends.get_or_create(user.id, input("League summoner name: ")) +except KeyboardInterrupt: + pass +else: + db.session.add(lol) +db.session.commit() +db.session.close() \ No newline at end of file diff --git a/static/lol-rank-icons/bronze_i.png b/static/lol-rank-icons/bronze_i.png new file mode 100644 index 00000000..81fc402a Binary files /dev/null and b/static/lol-rank-icons/bronze_i.png differ diff --git a/static/lol-rank-icons/bronze_ii.png b/static/lol-rank-icons/bronze_ii.png new file mode 100644 index 00000000..067956f5 Binary files /dev/null and b/static/lol-rank-icons/bronze_ii.png differ diff --git a/static/lol-rank-icons/bronze_iii.png b/static/lol-rank-icons/bronze_iii.png new file mode 100644 index 00000000..73b2d88f Binary files /dev/null and b/static/lol-rank-icons/bronze_iii.png differ diff --git a/static/lol-rank-icons/bronze_iv.png b/static/lol-rank-icons/bronze_iv.png new file mode 100644 index 00000000..fdbc0d32 Binary files /dev/null and b/static/lol-rank-icons/bronze_iv.png differ diff --git a/static/lol-rank-icons/bronze_v.png b/static/lol-rank-icons/bronze_v.png new file mode 100644 index 00000000..5f89799d Binary files /dev/null and b/static/lol-rank-icons/bronze_v.png differ diff --git a/static/lol-rank-icons/challenger.png b/static/lol-rank-icons/challenger.png new file mode 100644 index 00000000..eb97dd60 Binary files /dev/null and b/static/lol-rank-icons/challenger.png differ diff --git a/static/lol-rank-icons/diamond_i.png b/static/lol-rank-icons/diamond_i.png new file mode 100644 index 00000000..e112531d Binary files /dev/null and b/static/lol-rank-icons/diamond_i.png differ diff --git a/static/lol-rank-icons/diamond_ii.png b/static/lol-rank-icons/diamond_ii.png new file mode 100644 index 00000000..7e9ba9bd Binary files /dev/null and b/static/lol-rank-icons/diamond_ii.png differ diff --git a/static/lol-rank-icons/diamond_iii.png b/static/lol-rank-icons/diamond_iii.png new file mode 100644 index 00000000..218471fd Binary files /dev/null and b/static/lol-rank-icons/diamond_iii.png differ diff --git a/static/lol-rank-icons/diamond_iv.png b/static/lol-rank-icons/diamond_iv.png new file mode 100644 index 00000000..f5a7fbf7 Binary files /dev/null and b/static/lol-rank-icons/diamond_iv.png differ diff --git a/static/lol-rank-icons/diamond_v.png b/static/lol-rank-icons/diamond_v.png new file mode 100644 index 00000000..7420d41f Binary files /dev/null and b/static/lol-rank-icons/diamond_v.png differ diff --git a/static/lol-rank-icons/gold_i.png b/static/lol-rank-icons/gold_i.png new file mode 100644 index 00000000..284778a1 Binary files /dev/null and b/static/lol-rank-icons/gold_i.png differ diff --git a/static/lol-rank-icons/gold_ii.png b/static/lol-rank-icons/gold_ii.png new file mode 100644 index 00000000..329984ed Binary files /dev/null and b/static/lol-rank-icons/gold_ii.png differ diff --git a/static/lol-rank-icons/gold_iii.png b/static/lol-rank-icons/gold_iii.png new file mode 100644 index 00000000..e2f1f950 Binary files /dev/null and b/static/lol-rank-icons/gold_iii.png differ diff --git a/static/lol-rank-icons/gold_iv.png b/static/lol-rank-icons/gold_iv.png new file mode 100644 index 00000000..9059d215 Binary files /dev/null and b/static/lol-rank-icons/gold_iv.png differ diff --git a/static/lol-rank-icons/gold_v.png b/static/lol-rank-icons/gold_v.png new file mode 100644 index 00000000..09e614ed Binary files /dev/null and b/static/lol-rank-icons/gold_v.png differ diff --git a/static/lol-rank-icons/master.png b/static/lol-rank-icons/master.png new file mode 100644 index 00000000..09338d23 Binary files /dev/null and b/static/lol-rank-icons/master.png differ diff --git a/static/lol-rank-icons/platinum_i.png b/static/lol-rank-icons/platinum_i.png new file mode 100644 index 00000000..d85e1cb0 Binary files /dev/null and b/static/lol-rank-icons/platinum_i.png differ diff --git a/static/lol-rank-icons/platinum_ii.png b/static/lol-rank-icons/platinum_ii.png new file mode 100644 index 00000000..9d02c348 Binary files /dev/null and b/static/lol-rank-icons/platinum_ii.png differ diff --git a/static/lol-rank-icons/platinum_iii.png b/static/lol-rank-icons/platinum_iii.png new file mode 100644 index 00000000..bc90279f Binary files /dev/null and b/static/lol-rank-icons/platinum_iii.png differ diff --git a/static/lol-rank-icons/platinum_iv.png b/static/lol-rank-icons/platinum_iv.png new file mode 100644 index 00000000..3a64a145 Binary files /dev/null and b/static/lol-rank-icons/platinum_iv.png differ diff --git a/static/lol-rank-icons/platinum_v.png b/static/lol-rank-icons/platinum_v.png new file mode 100644 index 00000000..8b89b473 Binary files /dev/null and b/static/lol-rank-icons/platinum_v.png differ diff --git a/static/lol-rank-icons/provisional.png b/static/lol-rank-icons/provisional.png new file mode 100644 index 00000000..5fdcf3cc Binary files /dev/null and b/static/lol-rank-icons/provisional.png differ diff --git a/static/lol-rank-icons/silver_i.png b/static/lol-rank-icons/silver_i.png new file mode 100644 index 00000000..4af3291b Binary files /dev/null and b/static/lol-rank-icons/silver_i.png differ diff --git a/static/lol-rank-icons/silver_ii.png b/static/lol-rank-icons/silver_ii.png new file mode 100644 index 00000000..9f7a552e Binary files /dev/null and b/static/lol-rank-icons/silver_ii.png differ diff --git a/static/lol-rank-icons/silver_iii.png b/static/lol-rank-icons/silver_iii.png new file mode 100644 index 00000000..879da7c4 Binary files /dev/null and b/static/lol-rank-icons/silver_iii.png differ diff --git a/static/lol-rank-icons/silver_iv.png b/static/lol-rank-icons/silver_iv.png new file mode 100644 index 00000000..4b55f25d Binary files /dev/null and b/static/lol-rank-icons/silver_iv.png differ diff --git a/static/lol-rank-icons/silver_v.png b/static/lol-rank-icons/silver_v.png new file mode 100644 index 00000000..8db56b02 Binary files /dev/null and b/static/lol-rank-icons/silver_v.png differ diff --git a/static/royal.css b/static/royal.css new file mode 100644 index 00000000..f1db1ed2 --- /dev/null +++ b/static/royal.css @@ -0,0 +1,55 @@ +body { + background-color: #ff7f00; + color: black; +} + +table { + background-color: #fff2cd !important; + border-radius: 5px; +} + +.table td, .table th { + border: none !important; +} + +table.rl { + background: linear-gradient(to bottom,rgba(35,91,139,.5),rgba(16,54,84,.5)),linear-gradient(to right,rgba(35,91,139,.7),rgba(16,54,84,.7)) !important; + border-radius: 6px !important; + border: none !important; + padding: 12px !important; + color: white !important; +} + +.rl-rank-hidden { + display: none; +} + +.rl-rank-text { + display: inline-block; + vertical-align: middle; +} + +.rl-rank-division { + font-size: 9px; +} + +.thirtytwo { + width: 32px; + height: 32px; +} + +.round { + border-radius: 16px; +} + +.slightly-round { + border-radius: 2px; +} + +.rl-rank-number { + line-height: 14px; +} + +.rl-unranked { + color: grey; +} \ No newline at end of file diff --git a/static/sorttable.js b/static/sorttable.js new file mode 100644 index 00000000..719d2adb --- /dev/null +++ b/static/sorttable.js @@ -0,0 +1,495 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backwards compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + if (!node) return ""; + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + + +
+

+ Dota 2 +

+ + + + + + + + + + + + {% for record in dota_data %} + + + + + + + + {% endfor %} + +
RoyalSteamWinsSolo MMRParty MMR
{{ record.steam.royal.username }} {{ record.steam.persona_name }}{{ record.wins }}{{ record.solo_mmr if record.solo_mmr is not none}}{{ record.party_mmr if record.party_mmr is not none}}
+

+ Rocket League +

+ + + + + + + + + + + + + {% for record in rl_data %} + + + + + + + + + {% endfor %} + +
RoyalSteamSingolo 1v1Doppio 2v2Standard 3v3Solo Standard SoloQ
{{ record.steam.royal.username }} {{ record.steam.persona_name }} + {% if record.single_rank is not none %} + +
+
{{ record.single_mmr }}
+
Div {{ record.single_div + 1 }}
+
+ {% elif record.single_mmr is not none %} + +
+
{{ record.single_mmr }}
+
Inattivo
+
+ {% endif %} +
+ {% if record.doubles_rank is not none %} + +
+
{{ record.doubles_mmr }}
+
Div {{ record.doubles_div + 1 }}
+
+ {% elif record.doubles_mmr is not none %} + +
+
{{ record.doubles_mmr }}
+
Inattivo
+
+ {% endif %} +
+ {% if record.standard_rank is not none %} + +
+
{{ record.standard_mmr }}
+
Div {{ record.standard_div + 1 }}
+
+ {% elif record.standard_mmr is not none %} + +
+
{{ record.standard_mmr }}
+
Inattivo
+
+ {% endif %} +
+ {% if record.solo_std_rank is not none %} + +
+
{{ record.solo_std_mmr }}
+
Div {{ record.solo_std_div + 1 }}
+
+ {% elif record.solo_std_mmr is not none %} + +
+
{{ record.solo_std_mmr }}
+
Inattivo
+
+ {% endif %} +
+

+ Overwatch +

+ + + + + + + + + + + {% for record in ow_data %} + + + + + + + {% endfor %} + +
RoyalBattletagLivelloRank
{{ record.royal.username }} {{ record }}{{ record.level }} + {% if record.rank is not none %} + + {{ record.rank }} + {% endif %} +
+

+ Osu! +

+ + + + + + + + + + + + + {% for record in osu_data %} + + + + + + + + + {% endfor %} + +
RoyalUsernameosu!osu!taikoosu!catchosu!mania
{{ record.royal.username }} {{ record.osu_name }}{{ record.std_pp|round(0, "floor")|int if record.std_pp is not none and record.std_pp >= 1 }}{{ record.taiko_pp|round(0, "floor")|int if record.taiko_pp is not none and record.taiko_pp >= 1 }}{{ record.catch_pp|round(0, "floor")|int if record.catch_pp is not none and record.catch_pp >= 1 }}{{ record.mania_pp|round(0, "floor")|int if record.mania_pp is not none and record.mania_pp >= 1 }}
+

+ League of Legends +

+ + + + + + + + + + + + + {% for record in lol_data %} + + + + + {% if record.solo_division is not none %} + + {% else %} + + {% endif %} + {% if record.flex_division is not none %} + + {% else %} + + {% endif %} + {% if record.twtr_division is not none %} + + {% else %} + + {% endif %} + + {% endfor %} + +
RoyalSummonerLivelloSolo SRFlex SRFlex TT
{{ record.royal.username }} {{ record.summoner_name }}{{ record.level }} {{ record.solo_division.name|capitalize }} {{ record.solo_rank.name }} {{ record.flex_division.name|capitalize }} {{ record.flex_rank.name }} {{ record.twtr_division.name|capitalize }} {{ record.twtr_rank.name }}
+
+ + \ No newline at end of file diff --git a/update.py b/update.py index 368b9192..623781b2 100644 --- a/update.py +++ b/update.py @@ -2,14 +2,11 @@ import db import errors import time -# Create a new database session -session = db.Session() - # Stop updating if Ctrl-C is pressed try: # Update Steam print("STEAM") - for user in session.query(db.Steam).all(): + for user in db.session.query(db.Steam).all(): print(f"Updating {user.royal.username}", end="\t\t", flush=True) try: user.update() @@ -20,10 +17,10 @@ try: else: print("OK") finally: - time.sleep(1) + time.sleep(0.5) # Update Rocket League print("ROCKET LEAGUE") - for user in session.query(db.RocketLeague).all(): + for user in db.session.query(db.RocketLeague).all(): print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) try: user.update() @@ -34,10 +31,10 @@ try: else: print("OK") finally: - time.sleep(1) + time.sleep(0.5) # Update Dota 2 print("DOTA 2") - for user in session.query(db.Dota).all(): + for user in db.session.query(db.Dota).all(): print(f"Updating {user.steam.royal.username}", end="\t\t", flush=True) try: user.update() @@ -48,10 +45,10 @@ try: else: print("OK") finally: - time.sleep(1) + time.sleep(0.5) # Update League of Legends print("LEAGUE OF LEGENDS") - for user in session.query(db.LeagueOfLegends).all(): + for user in db.session.query(db.LeagueOfLegends).all(): print(f"Updating {user.royal.username}", end="\t\t", flush=True) try: user.update() @@ -62,10 +59,10 @@ try: else: print("OK") finally: - time.sleep(1) + time.sleep(0.5) # Update Osu! print("OSU!") - for user in session.query(db.Osu).all(): + for user in db.session.query(db.Osu).all(): print(f"Updating {user.royal.username}", end="\t\t", flush=True) try: user.update() @@ -76,10 +73,10 @@ try: else: print("OK") finally: - time.sleep(1) + time.sleep(0.5) # Update Overwatch print("OVERWATCH") - for user in session.query(db.Overwatch).all(): + for user in db.session.query(db.Overwatch).all(): print(f"Updating {user.royal.username}", end="\t\t", flush=True) try: user.update() @@ -90,10 +87,11 @@ try: else: print("OK") finally: - time.sleep(1) + time.sleep(0.5) except KeyboardInterrupt: pass finally: print("Committing...\t\t") - session.commit() - print("OK") \ No newline at end of file + db.session.commit() + print("OK") + db.session.close() \ No newline at end of file diff --git a/webserver.py b/webserver.py new file mode 100644 index 00000000..bc0121be --- /dev/null +++ b/webserver.py @@ -0,0 +1,20 @@ +from flask import Flask, render_template +from db import session, Session, Royal, Steam, RocketLeague, Dota, Osu, Overwatch, LeagueOfLegends + +app = Flask(__name__) + +app.jinja_env.trim_blocks = True +app.jinja_env.lstrip_blocks = True + +@app.route("/leaderboards") +def page_leaderboards(): + dota_data = session.query(Dota).join(Steam).join(Royal).all() + rl_data = session.query(RocketLeague).join(Steam).join(Royal).all() + ow_data = session.query(Overwatch).join(Royal).all() + osu_data = session.query(Osu).join(Royal).all() + lol_data = session.query(LeagueOfLegends).join(Royal).all() + return render_template("leaderboards.html", dota_data=dota_data, rl_data=rl_data, ow_data=ow_data, osu_data=osu_data, lol_data=lol_data) + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=1234, debug=True) + session.close() \ No newline at end of file