cal: add event name to filename
This commit is contained in:
parent
3297991d83
commit
1f21d0475f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user