diff --git a/utils/refresh-events.py b/utils/refresh-events.py index 6270e73..302e451 100755 --- a/utils/refresh-events.py +++ b/utils/refresh-events.py @@ -1,18 +1,24 @@ +import configparser import caldav import vobject from datetime import datetime, date, time, timedelta import yaml import os -"""CalDAV server url""" -server_url = "https://***REMOVED*** -"""CalDAV calendar url""" -cal_url = "https://***REMOVED*** -"""CalDAV username""" -cal_user = "tobias" + +# read ini file +cp = configparser.ConfigParser() +cp.read('../config.ini') +server_url = cp["CalDAV"]["server_url"] +cal_url = cp["CalDAV"]["cal_url"] +cal_user = cp["CalDAV"]["cal_user"] +cal_pass = cp["CalDAV"]["cal_pass"] + +print + """Category to filter events for. Only events that belong to this category will be processed.""" cal_category = "Veranstaltung" -"""Name of the file the YAML data will be writte to.""" +"""Name of the file the YAML data will be written to.""" result_file = "../content/pages/termine.md" """List of icalendar properties that will be passed on to Pelican. At this time, all properties are used except those regarding alarms.""" cal_properties = [ # taken from ical specification @@ -85,10 +91,6 @@ def extractEventData(events): e_tmp.append(d) return e_tmp -# get password -with open(".caldav_pass", "r") as f: - cal_pass = f.read().strip() - # create vobject calendar vcal = vobject.newFromBehavior("vcalendar")