|
|
@ -58,7 +58,7 @@ def parse_timedelta(ev): |
|
|
|
:returns: timedelta |
|
|
|
""" |
|
|
|
|
|
|
|
chunks = ev['event-duration'].split() |
|
|
|
chunks = ev['event_duration'].split() |
|
|
|
tdargs = {} |
|
|
|
for c in chunks: |
|
|
|
try: |
|
|
@ -67,11 +67,11 @@ def parse_timedelta(ev): |
|
|
|
tdargs[m] = val |
|
|
|
except KeyError: |
|
|
|
log.error("""Unknown time multiplier '%s' value in the \ |
|
|
|
'event-duration' field in the '%s' event. Supported multipliers \ |
|
|
|
'event_duration' field in the '%s' event. Supported multipliers \ |
|
|
|
are: '%s'.""" % (c, ev['title'], ' '.join(TIME_MULTIPLIERS))) |
|
|
|
raise RuntimeError("Unknown time multiplier '%s'" % c) |
|
|
|
except ValueError: |
|
|
|
log.error("""Unable to parse '%s' value in the 'event-duration' \ |
|
|
|
log.error("""Unable to parse '%s' value in the 'event_duration' \ |
|
|
|
field in the '%s' event.""" % (c, ev['title'])) |
|
|
|
raise ValueError("Unable to parse '%s'" % c) |
|
|
|
|
|
|
@ -96,23 +96,23 @@ def parse_article(generator, metadata): |
|
|
|
|
|
|
|
:returns: None |
|
|
|
""" |
|
|
|
if 'event-start' not in metadata: |
|
|
|
if 'event_start' not in metadata: |
|
|
|
return |
|
|
|
|
|
|
|
dtstart = parse_tstamp(metadata, 'event-start') |
|
|
|
dtstart = parse_tstamp(metadata, 'event_start') |
|
|
|
rrule=[] |
|
|
|
if 'event-end' in metadata: |
|
|
|
dtend = parse_tstamp(metadata, 'event-end') |
|
|
|
if 'event_end' in metadata: |
|
|
|
dtend = parse_tstamp(metadata, 'event_end') |
|
|
|
|
|
|
|
elif 'event-duration' in metadata: |
|
|
|
elif 'event_duration' in metadata: |
|
|
|
dtdelta = parse_timedelta(metadata) |
|
|
|
dtend = dtstart + dtdelta |
|
|
|
|
|
|
|
if 'event-recurring' in metadata: |
|
|
|
rrule = parse_recursion(metadata, 'event-recurring') |
|
|
|
if 'event_recurring' in metadata: |
|
|
|
rrule = parse_recursion(metadata, 'event_recurring') |
|
|
|
|
|
|
|
else: |
|
|
|
msg = "Either 'event-end' or 'event-duration' must be" + \ |
|
|
|
msg = "Either 'event_end' or 'event_duration' must be" + \ |
|
|
|
" speciefied in the event named '%s'" % metadata['title'] |
|
|
|
log.error(msg) |
|
|
|
raise ValueError(msg) |
|
|
@ -170,13 +170,13 @@ def generate_ical_file(generator): |
|
|
|
priority=5, |
|
|
|
uid=e.metadata['title'], |
|
|
|
) |
|
|
|
if 'event-location' in e.metadata: |
|
|
|
ie.add('location', e.metadata['event-location']) |
|
|
|
if 'event_location' in e.metadata: |
|
|
|
ie.add('location', e.metadata['event_location']) |
|
|
|
elif default_loc: |
|
|
|
ie.add('location', default_loc) |
|
|
|
|
|
|
|
|
|
|
|
if 'event-recurring' in e.metadata: |
|
|
|
if 'event_recurring' in e.metadata: |
|
|
|
if len(e.rrule)>=2: |
|
|
|
ie.add('rrule', {'freq':e.rrule[0],'until':e.rrule[1]}) |
|
|
|
else: |
|
|
|