Generate ics files correctly, incl. merged all.ics
This commit is contained in:
parent
c4069f84f8
commit
b36d187b37
|
@ -2,9 +2,9 @@
|
||||||
title: "Chaosradio"
|
title: "Chaosradio"
|
||||||
subtitle: "Der Podcast im Radio"
|
subtitle: "Der Podcast im Radio"
|
||||||
date: 2018-05-17T22:47:26+02:00
|
date: 2018-05-17T22:47:26+02:00
|
||||||
rrule: "FREQ=MONTHLY;BYSETPOS=-1;BYDAY=TH;INTERVAL=1"
|
|
||||||
dtstart: 20180628T220000
|
dtstart: 20180628T220000
|
||||||
dtend: 20180629T000000
|
dtend: 20180629T000000
|
||||||
|
rrule: "FREQ=MONTHLY;BYSETPOS=-1;BYDAY=TH;INTERVAL=1"
|
||||||
location: "CCCB oder Fritz"
|
location: "CCCB oder Fritz"
|
||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
title: "Club Discordia"
|
title: "Club Discordia"
|
||||||
subtitle: "Die offenen Abende im CCCB"
|
subtitle: "Die offenen Abende im CCCB"
|
||||||
date: 2018-05-17T22:59:56+02:00
|
date: 2018-05-17T22:59:56+02:00
|
||||||
dtstart: 2018070300000
|
dtstart: 20180703T190000
|
||||||
dtend: 20180704T000000
|
dtend: 20180704T000000
|
||||||
rrule: "FREQ=WEEKLY;BYDAY=TU,TH;INTERVAL=1"
|
rrule: "FREQ=WEEKLY;BYDAY=TU,TH;INTERVAL=1"
|
||||||
menu:
|
menu:
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
title: "Chaos macht Schule"
|
title: "Chaos macht Schule"
|
||||||
subtitle: "Technikkompetenzvermittlung"
|
subtitle: "Technikkompetenzvermittlung"
|
||||||
date: 2018-05-18T01:11:54+02:00
|
date: 2018-05-18T01:11:54+02:00
|
||||||
rrule: "FREQ=MONTHLY;BYSETPOS=1;BYDAY=TH;INTERVAL=1"
|
|
||||||
dtstart: 20180705T190000
|
dtstart: 20180705T190000
|
||||||
dtend: 20180705T230000
|
dtend: 20180705T230000
|
||||||
|
rrule: "FREQ=MONTHLY;BYSETPOS=1;BYDAY=TH;INTERVAL=1"
|
||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: "veranstaltungen"
|
parent: "veranstaltungen"
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
title: "Coder Dojo"
|
title: "Coder Dojo"
|
||||||
subtitle: Hacken und Coden für Kinder
|
subtitle: Hacken und Coden für Kinder
|
||||||
date: 2018-05-18T09:51:02+02:00
|
date: 2018-05-18T09:51:02+02:00
|
||||||
|
dtstart: 20180623T140000
|
||||||
|
dtend: 20180623T170000
|
||||||
rrule: "FREQ=MONTHLY;BYSETPOS=3;BYDAY=SA;INTERVAL=1"
|
rrule: "FREQ=MONTHLY;BYSETPOS=3;BYDAY=SA;INTERVAL=1"
|
||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
title: "Plenum"
|
title: "Plenum"
|
||||||
subtitle: "Instrument der internen Konsensfindung"
|
subtitle: "Instrument der internen Konsensfindung"
|
||||||
date: 2018-05-18T01:11:54+02:00
|
date: 2018-05-18T01:11:54+02:00
|
||||||
rrule: "FREQ=MONTHLY;BYSETPOS=1;BYDAY=WE;INTERVAL=1"
|
|
||||||
dtstart: 20180704T200000
|
dtstart: 20180704T200000
|
||||||
dtend: 20180704T220000
|
dtend: 20180704T220000
|
||||||
|
rrule: "FREQ=MONTHLY;BYSETPOS=1;BYDAY=WE;INTERVAL=1"
|
||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: "verein"
|
parent: "verein"
|
||||||
|
|
|
@ -11,14 +11,12 @@ TZOFFSETFROM:+0100
|
||||||
TZOFFSETTO:+0200
|
TZOFFSETTO:+0200
|
||||||
TZNAME:CEST
|
TZNAME:CEST
|
||||||
DTSTART:19700329T020000
|
DTSTART:19700329T020000
|
||||||
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
|
|
||||||
END:DAYLIGHT
|
END:DAYLIGHT
|
||||||
BEGIN:STANDARD
|
BEGIN:STANDARD
|
||||||
TZOFFSETFROM:+0200
|
TZOFFSETFROM:+0200
|
||||||
TZOFFSETTO:+0100
|
TZOFFSETTO:+0100
|
||||||
TZNAME:CET
|
TZNAME:CET
|
||||||
DTSTART:19701025T030000
|
DTSTART:19701025T030000
|
||||||
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
|
|
||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
BEGIN:VEVENT
|
BEGIN:VEVENT
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{{if isset .Params "rrule"}}
|
{{if isset .Params "rrule"}}BEGIN:VCALENDAR
|
||||||
BEGIN:VCALENDAR
|
|
||||||
VERSION:2.0
|
VERSION:2.0
|
||||||
PRODID:-//cccb//datengarten calendar//EN
|
PRODID:-//cccb//datengarten calendar//EN
|
||||||
CALSCALE:GREGORIAN
|
CALSCALE:GREGORIAN
|
||||||
|
@ -18,13 +17,12 @@ TZOFFSETFROM:+0200
|
||||||
TZOFFSETTO:+0100
|
TZOFFSETTO:+0100
|
||||||
TZNAME:CET
|
TZNAME:CET
|
||||||
DTSTART:19701025T030000
|
DTSTART:19701025T030000
|
||||||
RRULE:{{.Params.rrule}}
|
|
||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
BEGIN:VEVENT
|
BEGIN:VEVENT
|
||||||
ORGANIZER;CN="CCCB":mailto:mail@berlin.ccc.de
|
ORGANIZER;CN="CCCB":mailto:mail@berlin.ccc.de
|
||||||
SUMMARY:{{.Title}}
|
SUMMARY:{{.Title}}
|
||||||
UID: {{.Title}}@berlin.ccc.de
|
UID:{{lower (replace .Title " " "")}}@berlin.ccc.de
|
||||||
SEQUENCE:0
|
SEQUENCE:0
|
||||||
STATUS:CONFIRMED
|
STATUS:CONFIRMED
|
||||||
DTSTAMP:20180508T200000Z
|
DTSTAMP:20180508T200000Z
|
||||||
|
|
25
tools/merge_cals.py
Executable file
25
tools/merge_cals.py
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from glob import glob
|
||||||
|
import icalendar
|
||||||
|
import pytz
|
||||||
|
|
||||||
|
cals=[]
|
||||||
|
merged=icalendar.Calendar()
|
||||||
|
merged.add('prodid', '-//CCCB Calendar Generator//berlin.ccc.de//')
|
||||||
|
merged.add('version', '2.0')
|
||||||
|
|
||||||
|
for icsfilestr in glob("public/*/**/*.ics", recursive=True):
|
||||||
|
with open(icsfilestr, 'r') as icsfile:
|
||||||
|
print("Importing", icsfilestr)
|
||||||
|
cals.append(icalendar.Calendar.from_ical(icsfile.read()))
|
||||||
|
|
||||||
|
for cal in cals:
|
||||||
|
for e in cal.subcomponents:
|
||||||
|
merged.add_component(e)
|
||||||
|
|
||||||
|
outfile="static/all.ics"
|
||||||
|
with open(outfile, 'wb') as f:
|
||||||
|
print(f"writing to {outfile}...")
|
||||||
|
f.write(merged.to_ical())
|
||||||
|
|
Loading…
Reference in a new issue