# Studywatch This is a set of scripts. - **The cli client** script tracks study sessions and syncs them with a CalDAV calendar. - **The apple shortcut client** allows - **The server** script reads from said CalDAV calendar and serves a nice-looking web UI and API endpoint. ## Usage ### Clients #### cli script A very simple implementation, but a good demonstration of the power of using CalDAV as a DB. 1. Create an `.env` following the `.env.example` layout and fill in all fields. 2. Run as `./studywatch-cli ` (available subjects are also defined in `.env`). 3. Previous, failed syncs are stored in `./backlog.csv` and will be reattempted first. 4. The new session will start and display a live timer. To stop it, send `SIGINT` (Ctrl+C). 5. You will be asked if you want to sync the session (y|n). #### Apple Shortcut **Requirement:** Toolbox Pro app `Start Learning`: Lets you select a subject and saves it, together with a timestamp, to a global (Toolbox Pro) variable. `Stop Learning`: Creates a calendar event from the session stored in the global variable. All with fancy menus, of course. ### Server The server is written in Python using Flask. It grabs the calendar events via CalDAV and renders a nice-looking UI. **Heads-up**: the entire frontend is vibe-coded. I'm not much of a web dev. The backend is written by me but isn't the greatest code quality. I just needed it to work, and it does work great! #### Install 1. Copy `server/docker-compose.yaml` and `server/.env.example`. 2. Rename `.env.example` to `.env`, make sure it's in the same directory as the compose file, and fill in all fields. 3. Run `docker compose up -d`. 4. Open at `0.0.0.0:5000`. ### Screenshots