| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
import sys |
| 8 |
from pathlib import Path |
| 9 |
|
| 10 |
import icalendar |
| 11 |
|
| 12 |
import recurring_ical_events |
| 13 |
|
| 14 |
HERE = Path(__file__).parent or Path() |
| 15 |
sys.path.append(HERE.parent) |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
text = [] |
| 20 |
with Path(HERE / "issue42.ics").open("rb") as fobj: |
| 21 |
text += fobj.readlines() |
| 22 |
text_utf = [i.decode("utf-8") for i in text] |
| 23 |
|
| 24 |
ical_string = "".join(text_utf) |
| 25 |
|
| 26 |
|
| 27 |
calendar = icalendar.Calendar.from_ical(ical_string) |
| 28 |
|
| 29 |
rec_calendar = recurring_ical_events.of(calendar) |
| 30 |
|
| 31 |
for day in range(1, 29): |
| 32 |
print("day", day) |
| 33 |
start_date = (2011, 11, day) |
| 34 |
events = rec_calendar.at(start_date) |