update for 2024 worlds

main
Benjamin Kraft 4 months ago
parent 91d6d1f54b
commit 49d64d40c6
  1. 1
      .env.example
  2. 13
      main.py

@ -0,0 +1 @@
CALENDAR_ID=

@ -36,7 +36,7 @@ class Match:
if self.stage == "Swiss": if self.stage == "Swiss":
if self.roundName in ["Round 1", "Round 2"]: if self.roundName in ["Round 1", "Round 2"]:
return 1 return 1
if self.roundName == "Round 3" and self.time.day == 22: if self.roundName == "Round 3" and self.time.day == 6:
return 1 return 1
return 3 return 3
if self.stage == "Knockout": if self.stage == "Knockout":
@ -94,9 +94,8 @@ class Match:
def fetch_matches(): def fetch_matches():
sources = [ sources = [
"https://lol.fandom.com/wiki/2023_Worlds_Qualifying_Series", "https://lol.fandom.com/wiki/2024_Season_World_Championship/Play-In",
"https://lol.fandom.com/wiki/2023_Season_World_Championship/Play-In", "https://lol.fandom.com/wiki/2024_Season_World_Championship/Main_Event"
"https://lol.fandom.com/wiki/2023_Season_World_Championship/Main_Event"
] ]
stages = ["Play-In", "Swiss", "Knockout"] stages = ["Play-In", "Swiss", "Knockout"]
@ -114,7 +113,7 @@ def fetch_matches():
raw_matches: list[Tag] = match_list.find_all(attrs={"class", "ml-row"}) raw_matches: list[Tag] = match_list.find_all(attrs={"class", "ml-row"})
# somehow identify stage... # somehow identify stage...
stage = stages[0] if (src == sources[0] or src == sources[1]) else \ stage = stages[0] if (src == sources[0]) else \
(stages[1] if "Round" in roundName else stages[2]) (stages[1] if "Round" in roundName else stages[2])
for raw_match in raw_matches: for raw_match in raw_matches:
@ -152,8 +151,8 @@ def fetch_matches():
def get_calendar_events(): def get_calendar_events():
api = get_service() api = get_service()
start = "2023-04-01T00:00:00Z" start = "2024-04-01T00:00:00Z"
end = "2023-11-20T00:00:00Z" end = "2024-12-01T00:00:00Z"
calendarId = os.environ.get("CALENDAR_ID") calendarId = os.environ.get("CALENDAR_ID")
events = api.events().list( events = api.events().list(
calendarId=calendarId, timeMin=start, timeMax=end, calendarId=calendarId, timeMin=start, timeMax=end,

Loading…
Cancel
Save