Commit 7c8ba211 authored by edpibu's avatar edpibu 🚵🏻

Added support for custom output directories

parent 784093d9
#output_directory: '/srv/http'
url: ''
#!/usr/bin/env python3
import logging
import os.path
from datetime import datetime, timedelta
import caldav
......@@ -25,6 +26,11 @@ class Configuration:
self.calendars = client.principal().calendars()
self.selected_groups = c['selected_groups']
if 'output_directory' in c.keys():
self.output_directory = c['output_directory']
self.output_directory = '.'
def get_all_dav_components(self):
"""Return all components from the given calendars"""
......@@ -66,5 +72,5 @@ if __name__ == '__main__':
conf = Configuration('config.yml') # Load user configuration and calendars
dav_components = conf.get_all_dav_components() # Load components
with open('calendar.ics', 'wb') as f: # Write master calendar
with open(os.path.join(conf.output_directory, 'calendar.ics'), 'wb') as f: # Write master calendar
write_calendar_from_dav(f, dav_components, conf.selected_groups)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment