Add configurable output folder

This commit is contained in:
sqozz 2021-10-07 12:09:34 +02:00
parent 63f086651c
commit 2771d67f74
2 changed files with 7 additions and 4 deletions

View File

@ -2,3 +2,6 @@
city=Nürnberg
street=Am Pointgraben
house_number=7
[calendar]
target=/var/lib/radicale/collection/trash_dates

View File

@ -65,15 +65,15 @@ radicale_props = {
"tag": "VCALENDAR"
}
processed_cals = os.path.join(".", "calendars")
if not os.path.exists(processed_cals):
os.makedirs(processed_cals)
target_path = config.get("calendar", "target", fallback=os.path.join(".", "calendars"))
if not os.path.exists(target_path):
os.makedirs(target_path)
for trash_type in trash_types:
radicale_props["D:displayname"] = trash_type.get("name")
radicale_props["ICAL:calendar-color"] = "#{}ff".format(trash_type.get("farbeRgb", "000000"))
folder_name = trash_type.get("name").replace("/", "_")
trash_type_folder = os.path.join(processed_cals, folder_name)
trash_type_folder = os.path.join(target_path, folder_name)
if not os.path.exists(trash_type_folder):
os.makedirs(trash_type_folder)