-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtournament_status.py
executable file
·39 lines (32 loc) · 1.19 KB
/
tournament_status.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
def check_status(soup):
status = soup.find_all("div", class_="status")[0].find_all("span")[0].text.upper()
active = 'FINAL' not in status
if not active:
rounds_complete = 4
live=False
else:
if "Play Complete".upper() in status:
status_split = status.split(" ")
rounds_complete = int(status_split[1])
live=False
elif "In Progress".upper() in status:
status_split = status.split(" ")
rounds_complete=int(status_split[1])-1
live=True
elif "Suspended".upper() in status:
status_split = status.split(" ")
print("Play suspended in round: {}".format(status_split[1]))
live=False
rounds_complete = int(status_split[1]) - 1
else:
print("Unknown tournament status...exitting")
sys.exit()
return rounds_complete,live
def get_par(soup):
course_info = soup.find_all("div",class_="Leaderboard__Course__Location__Detail")[0]
return int(course_info.text[3:5])
def get_tournament_name(soup):
#4/12/21 Tyler changed the class tag
tournament_name = soup.find_all("h1",class_="headline headline__h1 Leaderboard__Event__Title")[0].text
return tournament_name