Browse Source

fixed one-map games, added match separators

master
sose 3 months ago
parent
commit
893abeaacd
  1. 43
      gemhltv_matches

43
gemhltv_matches

@ -17,6 +17,9 @@ with open(LOGO_FILE, "r") as logo:
print("```\n" + logo.read() + "\n```")
def print_matches(match_list):
print("```")
print("\n━━━━\n")
print("```")
for match in match_list:
stars = int(match["stars"])
start_time = None;
@ -34,34 +37,43 @@ def print_matches(match_list):
star_rating += ")"
else:
stars = ""
print("```")
print("┏━━━━━━━━━━━")
print("```")
print("## {} {}".format(title, star_rating))
if match["maps_won"] != []:
if match["rounds_won"] == []: # match is over
if match["rounds_won"] != []: # match is live
if match["maps_won"] != []: # match has multiple maps
print(
"{} [{}] - [{}] {}".format(
"{} [{}({})]\nVS.\n{} [{}({})]".format(
match["team_names"][0],
match["rounds_won"][0],
match["maps_won"][0],
match["maps_won"][1],
match["team_names"][1],
match["rounds_won"][1],
match["maps_won"][1],
)
)
print("FINAL")
else: # match is live
print("⏺️ LIVE")
else: # match only has one map
print(
"{} [{}({})]\nVS.\n{} [{}({})]".format(
"{} [{}]\nVS.\n{} [{}]".format(
match["team_names"][0],
match["rounds_won"][0],
match["maps_won"][0],
match["team_names"][1],
match["rounds_won"][1],
match["maps_won"][1],
)
)
print("⏺️ LIVE")
elif match["maps_won"] != []: # match is over
print(
"{} [{}] - [{}] {}".format(
match["team_names"][0],
match["maps_won"][0],
match["maps_won"][1],
match["team_names"][1],
)
)
print("FINAL")
else: # match is upcoming, start time will always be an int here
start_time = int(match["start_time"]) // 1000 # convert ms unix time to normal
start_time = datetime.utcfromtimestamp(start_time)
@ -74,8 +86,9 @@ def print_matches(match_list):
)
)
print("🕗 " + start_time)
print("```")
print("┗━━━━━━━━━━━")
print("\n━━━━")
print("```")
print("")
@ -90,7 +103,7 @@ if len(live_matches) != 0:
print("# LIVE")
print_matches(live_matches)
else:
print("# LIVE")
print("# LIVE\n")
print("No live matches right now.\n")
if len(upcoming_matches) != 0:
print("# UPCOMING")
@ -101,4 +114,4 @@ if len(ended_matches) != 0:
print("=> ?reload Refresh match list (only use this if a match that should be live is still in \"upcoming\")")
print("Powered by sk0R")
print("\nPowered by sk0R")
Loading…
Cancel
Save