This project automates the process of retrieving and managing referee schedules from two sources: RefCentre and COMET. It fetches schedules from these sources, stores them locally, serves them via an HTTP server, and provides access to the schedules through a hardware-based user interface implemented on an ESP32 using an LCD display and a rotary encoder for date selection.
- Automated login to RefCentre and COMET to scrape schedules.
- Files are saved in a structured format by date in a local directory.
- Abbreviations for leagues and fields are applied to make the data easier to read.
- The data is served locally via an HTTP server on port
8000. - A separate ESP32-based hardware system provides a UI for viewing schedules with a date selector.
- Install Python 3.x if not already installed.
- Install necessary Python libraries
- Install Playwright dependencies:
- Clone or download the project.
- Install the Arduino IDE or PlatformIO to program the ESP32.
- Download and install the required libraries.
- Upload the ESP32 code to your device.
- Run the script by executing "python webscrape.py"
- Enter your RefCentre and COMET credentials when prompted.
- The script will:
- Fetch schedules from both RefCentre and COMET.
- Save the schedules as .txt files in the local directory.
- Start an HTTP server that serves the schedules.
- You can access the schedule files by navigating to http://localhost:8000 or from another device on the same network using the IP address of the server.
- Upon boot, the ESP32 will connect to Wi-Fi and display the current date.
- Use the rotary encoder to select different dates and view the corresponding schedule fetched from the HTTP server.
- Press the button to confirm your selection.
- Scroll through games using rotary encoder.
-playwright -beautifulsoup4 -datetime -os -re -threading -time
-Wire.h (for I2C communication with LCD) -LiquidCrystal_I2C.h (for LCD display) -WiFi.h (for Wi-Fi connection) -HTTPClient.h (for HTTP requests)
The script fetches schedules from RefCentre and COMET by logging in with the credentials you provide. It saves schedules as .txt files in the C:\Ref Games directory and serves them on http://0.0.0.0:8000.
You can modify the location where the schedules are saved by editing the path variable in the main() function.
You will need to configure your Wi-Fi credentials within the ESP32 code:
- const char* ssid = "YOUR_SSID";
- const char* password = "YOUR_WIFI_PASSWORD";
- The ESP32 code interfaces with the Python backend using an HTTP client. When a date is selected on the LCD, the ESP32 fetches the corresponding schedule from the server and displays it on the screen.
- The rotary encoder allows you to scroll through dates.
- A button press confirms the selection of a date, triggering an HTTP request to the server to fetch the schedule for that date.
- LCD Display: Connected via I2C to the ESP32.
- Rotary Encoder: Connected to digital pins for reading pulses from the encoder.
- Button: Used to select dates and reset selections.