Merge "Fix single emtpy .ics file issue"
This commit is contained in:
commit
a813dc6a28
@ -102,18 +102,21 @@ class Meeting:
|
|||||||
# add event to calendar
|
# add event to calendar
|
||||||
cal.add_component(event)
|
cal.add_component(event)
|
||||||
|
|
||||||
# write ical files to disk
|
# determine file name from source file
|
||||||
ical_filename = self.filename.split('.')[0] + '.ics'
|
ical_filename = os.path.basename(self.filename).split('.')[0] + '.ics'
|
||||||
|
ical_filename = os.path.join(ical_dir, ical_filename)
|
||||||
|
|
||||||
if not os.path.exists(ical_dir):
|
if not os.path.exists(ical_dir):
|
||||||
os.makedirs(ical_dir)
|
os.makedirs(ical_dir)
|
||||||
|
|
||||||
|
# write ical files to disk
|
||||||
with open(ical_filename, 'wb') as ics:
|
with open(ical_filename, 'wb') as ics:
|
||||||
ics.write(cal.to_ical())
|
ics.write(cal.to_ical())
|
||||||
|
|
||||||
num_events = len(cal.subcomponents)
|
num_events = len(cal.subcomponents)
|
||||||
logging.info('\'%s\' processed. [%d event(s)]' % (ical_filename,
|
logging.info("Wrote %(num_events)d event(s) to file '%(ical_file)s'" %
|
||||||
num_events))
|
{'ical_file': ical_filename,
|
||||||
|
'num_events': num_events})
|
||||||
|
|
||||||
def get_schedule_tuple(self):
|
def get_schedule_tuple(self):
|
||||||
"""returns a list of meeting tuples consisting meeting name, meeting
|
"""returns a list of meeting tuples consisting meeting name, meeting
|
||||||
|
@ -45,7 +45,6 @@ def load_meetings(yaml_dir, meeting_list=None):
|
|||||||
continue
|
continue
|
||||||
meetings_yaml.append(yaml_file)
|
meetings_yaml.append(yaml_file)
|
||||||
|
|
||||||
print meetings_yaml
|
|
||||||
meetings = [Meeting(yaml.load(open(f, 'r')), f)
|
meetings = [Meeting(yaml.load(open(f, 'r')), f)
|
||||||
for f in meetings_yaml]
|
for f in meetings_yaml]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user