Aldaviva / GamesDoneQuickCalendarFactory

📅 Generate a list of events for GDQ in iCalendar (ICS) format
https://aldaviva.com/docs/gdq.ics
Apache License 2.0
11 stars 0 forks source link

Rewrite everything to handle GDQ's new JSON schedule #13

Closed Aldaviva closed 9 months ago

Aldaviva commented 9 months ago

For many years, GDQ's schedule was a server-side rendered HTML page with progressive JS enhancement, and this project parsed that HTML to generate an iCalendar file.

Now, right when AGDQ 2024 started, the schedule page switched to a client-side rendered JS webapp based on a JSON API. The two schedule pages are 0% compatible with each other. This project is currently returning an empty calendar because it can't find the HTML elements it expects.

In order to make this project work with the new JSON API, it needs to be almost completely rewritten.

Details

  1. Get the event ID. AGDQ 2024 has ID 46.
    1. Send an HTTP HEAD request to https://gamesdonequick.com/schedule
    2. Inspect the 302 response's Location header, which will contain a URL with the event ID in a path parameter, and will be in the form https://gamesdonequick.com/schedule/46.
  2. Send an HTTP GET request to https://gamesdonequick.com/tracker/api/v2/events/{id}/runs/
  3. It's not clear how pagination works, because the response object contains null values for both the previous and next properties (with count equal to 140) for AGDQ 2024.
  4. Extract the required properties from each object in the results array in order to construct GameRun instances.
    • start - starttime, which is a zoned ISO 8601 datetime
    • duration - endtime-starttime, subtract two zoned ISO 8601 datetimes to get the TimeSpan. Don't use runtime because that gets mutated after a run finishes to be the actual duration, instead of the expected duration.
    • name - either name or display_name, which both seem to always contain the same value
    • description - category + " — " + console; don't use the description property, which is always the empty string in AGDQ 2024
    • runners - runners[*].name
    • host - hosts[0].name; previously there were either 0 or 1 hosts for each run, but in AGDQ 2024 there is one run (The Legend of Zelda: Majora's Mask) with two hosts (brutal_melo and cartridgeblowers), which I think is a mistake because there are 0 commentators for that run
    • setupDuration - setuptime which is an ISO 8601 duration (h:mm:ss), or it can be 0. Not used for anything and probably safe to remove, unless we want to add it to the starttime in an attempt to make the event start when the run starts, not when the waiting screen appears.
    • The new JSON document includes the commentators for the first time, so we could add them too. commentators[*].name