-
Notifications
You must be signed in to change notification settings - Fork 0
/
ndc.py
31 lines (23 loc) · 914 Bytes
/
ndc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import yaml
from ics import Calendar
output = []
for filename in ["ndc-calendar-w1.ics", "ndc-calendar-w2.ics"]:
calendar = Calendar(open(f"cache/{filename}", "r"))
events = calendar.events
for event in events:
if event.all_day:
continue
if event.location == "NDC Partnership Pavillion, Hall E, Pavillion #22, Poland" or event.location is None:
location = "NDC Partnership Pavilion"
else:
location = "NDC Partnership: " + event.location
output.append({
"title": event.name,
"description": event.description.strip(),
"start": event.begin.datetime,
"end": event.end.datetime,
"source": "http://www.ndcpartnershipcop.org/events/",
"location": location,
})
print(output[-1])
yaml.dump(output, open("ndc.yaml", "w"), default_flow_style=False)