Commit a444559d authored by Alexandre (erdnaxe)'s avatar Alexandre (erdnaxe) 🎇

Merge branch 'output_directory_config' into 'master'

Added support for custom output directories

See merge request !4
parents 784093d9 7c8ba211
#output_directory: '/srv/http'
username: PUT_YOUR_USERNAME
url: 'https://agenda.ens-cachan.fr/SOGo/dav/'
selected_groups:
......
#!/usr/bin/env python3
import logging
import os.path
from datetime import datetime, timedelta
import caldav
......@@ -25,6 +26,11 @@ class Configuration:
password=password)
self.calendars = client.principal().calendars()
self.selected_groups = c['selected_groups']
if 'output_directory' in c.keys():
self.output_directory = c['output_directory']
else:
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