diff --git a/lumbunglib/cloudcal.py b/lumbunglib/cloudcal.py index d3d482f..fd27482 100644 --- a/lumbunglib/cloudcal.py +++ b/lumbunglib/cloudcal.py @@ -110,6 +110,11 @@ def localize_time(date): ) return localized_begins +def sanitize_name(name): + sanitized = "".join([c if c.isalnum() or c == " " else "-" for c in name]) + if len(sanitized) > 20: + return sanitized[:20] + return sanitized def create_event_post(post_dir, event): """ @@ -186,7 +191,7 @@ def update_event_post(post_dir, event): def main(): for event in list(cal.events): - post_dir = os.path.join(output_dir, event.uid) + post_dir = os.path.join(output_dir, sanitize_name(event.name) + "-" + event.uid) if event.uid not in existing_posts: # if there is an event we dont already have, make it