Extracts fitness class bookings from David Lloyd booking confirmation emails and maintains a web-accessible calendar.
Emails arrive at john.dl@critchley.bizMyDavidLloydSchedule.py processes booking emailsExtracts class details: date, time, class name, location, instructorMaintains calendar in GDBM databaseExports timetable.html for web viewing at https://www.critchley.biz/DavidLloyd/timetable.html
Main handler for David Lloyd emailsFunctions:• parse_dl_email(email_message): Extract booking details from HTML• update_calendar(booking): Add/update calendar entry• export_html(): Generate timetable.htmlDatabase: Uses ~/.dl.gdbm to store bookingsKey: Booking reference (from email)Value: JSON {start, end, class_name, instructor, location}
Helper functions for David Lloyd email processingParses HTML email body to extract booking confirmation details
Stored in GDBM with datetime fields:Key: booking_referenceValue: { 'start': '2026-02-01T10:00:00+00:00' (ISO8601) 'end': '2026-02-01T11:00:00+00:00' 'class_name': 'Body Combat', 'instructor': 'Sarah', 'location': 'Bristol', 'booking_reference': 'DL-12345'}
Generated timetable.html displays:• Weekly view of booked classes• Class name, time, instructor, location• Color-coded by class type• Automatically updated when new bookings arrive
Looks for patterns in David Lloyd confirmation emails:• Subject: Contains 'booking' or 'confirmation'• Body: HTML table with class details• Booking reference extracted for deduplicationHandles cancellations: Deletes entry from GDBM
Triggered by process_emails.py routerRuns after email retrieval from POP3Updates GDBM immediatelyHTML export scheduled by cron for web deployment