jazzband / icalevents

Python module for iCal URL/file parsing and querying.
MIT License
157 stars 72 forks source link

Optimization: support the use of an existing `icalendar.Calendar` object #130

Open mlindgren opened 5 months ago

mlindgren commented 5 months ago

icalparser.parse_events, and by extension icalevents.events, do not have an option to take an existing icalendar.Calendar object. Instead, you have to pass in the ICalendar file as a string, file path or URL. This means the calendar has to be re-parsed on every call.

I have a use case where I'd like to go through one calendar file and filter out all the events that are duplicated in a second calendar file. I expect that having to re-parse the second calendar for every event I potentially want to filter will be highly inefficient. Instead, I'd like to be able to load each calendar once and then repeatedly query the events in the second calendar.

Thanks!