output free/busy components instead of events
1 file changed, 7 insertions(+), 7 deletions(-)
changed files
M mycal.py → mycal.py
@@ -1,4 +1,4 @@ -from icalendar.cal import Calendar, Event +from icalendar.cal import Calendar, FreeBusy import requests from flask import Flask from datetime import date, datetime, timedelta, time@@ -71,12 +71,12 @@ if component.name == "VEVENT": dtstart = fixup_date(component.get('dtstart').dt) dtend = fixup_date(component.get('dtend', component.get('dtstart')).dt) if dtstart >= start_date and dtend <= end_date: - ev = Event() - ev.add('summary', f'{config.name} Busy') - ev.uid = component.get('uid') - ev.DTSTART = dtstart - ev.DTEND = dtend - output.add_component(ev) + busy = FreeBusy() + busy.add('summary', f'{config.name} Busy') + busy.uid = component.get('uid') + busy.add('dtstart', dtstart) + busy.add('dtend', dtend) + output.add_component(busy) return output.to_ical(), { "Content-Type": "text/plain" } except Exception as e: return f"Error parsing with icalendar: {str(e)}", 500