fixed one-map games, added match separators
This commit is contained in:
parent
50da22a22c
commit
893abeaacd
|
@ -17,6 +17,9 @@ with open(LOGO_FILE, "r") as logo:
|
||||||
print("```\n" + logo.read() + "\n```")
|
print("```\n" + logo.read() + "\n```")
|
||||||
|
|
||||||
def print_matches(match_list):
|
def print_matches(match_list):
|
||||||
|
print("```")
|
||||||
|
print("\n━━━━\n")
|
||||||
|
print("```")
|
||||||
for match in match_list:
|
for match in match_list:
|
||||||
stars = int(match["stars"])
|
stars = int(match["stars"])
|
||||||
start_time = None;
|
start_time = None;
|
||||||
|
@ -34,23 +37,10 @@ def print_matches(match_list):
|
||||||
star_rating += ")"
|
star_rating += ")"
|
||||||
else:
|
else:
|
||||||
stars = ""
|
stars = ""
|
||||||
print("```")
|
|
||||||
print("┏━━━━━━━━━━━")
|
|
||||||
print("```")
|
|
||||||
print("## {} {}".format(title, star_rating))
|
print("## {} {}".format(title, star_rating))
|
||||||
|
|
||||||
if match["maps_won"] != []:
|
if match["rounds_won"] != []: # match is live
|
||||||
if match["rounds_won"] == []: # match is over
|
if match["maps_won"] != []: # match has multiple maps
|
||||||
print(
|
|
||||||
"{} [{}] - [{}] {}".format(
|
|
||||||
match["team_names"][0],
|
|
||||||
match["maps_won"][0],
|
|
||||||
match["maps_won"][1],
|
|
||||||
match["team_names"][1],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
print("FINAL")
|
|
||||||
else: # match is live
|
|
||||||
print(
|
print(
|
||||||
"{} [{}({})]\nVS.\n{} [{}({})]".format(
|
"{} [{}({})]\nVS.\n{} [{}({})]".format(
|
||||||
match["team_names"][0],
|
match["team_names"][0],
|
||||||
|
@ -62,6 +52,28 @@ def print_matches(match_list):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
print("⏺️ LIVE")
|
print("⏺️ LIVE")
|
||||||
|
else: # match only has one map
|
||||||
|
print(
|
||||||
|
"{} [{}]\nVS.\n{} [{}]".format(
|
||||||
|
match["team_names"][0],
|
||||||
|
match["rounds_won"][0],
|
||||||
|
match["team_names"][1],
|
||||||
|
match["rounds_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
|
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 = int(match["start_time"]) // 1000 # convert ms unix time to normal
|
||||||
start_time = datetime.utcfromtimestamp(start_time)
|
start_time = datetime.utcfromtimestamp(start_time)
|
||||||
|
@ -74,8 +86,9 @@ def print_matches(match_list):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
print("🕗 " + start_time)
|
print("🕗 " + start_time)
|
||||||
|
|
||||||
print("```")
|
print("```")
|
||||||
print("┗━━━━━━━━━━━")
|
print("\n━━━━")
|
||||||
print("```")
|
print("```")
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
@ -90,7 +103,7 @@ if len(live_matches) != 0:
|
||||||
print("# LIVE")
|
print("# LIVE")
|
||||||
print_matches(live_matches)
|
print_matches(live_matches)
|
||||||
else:
|
else:
|
||||||
print("# LIVE")
|
print("# LIVE\n")
|
||||||
print("No live matches right now.\n")
|
print("No live matches right now.\n")
|
||||||
if len(upcoming_matches) != 0:
|
if len(upcoming_matches) != 0:
|
||||||
print("# UPCOMING")
|
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("=> ?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…
Reference in New Issue