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 city=Nürnberg
street=Am Pointgraben street=Am Pointgraben
house_number=7 house_number=7
[calendar]
target=/var/lib/radicale/collection/trash_dates

View file

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