cli commands

This commit is contained in:
cellarspoon
2021-12-15 12:23:37 +01:00
parent 30dbc6212f
commit b385833cbe
6 changed files with 154 additions and 190 deletions

View File

@ -1,8 +1,3 @@
#!/bin/python3
# lumbung.space calendar feed generator
# © 2021 roel roscam abbing gplv3 etc
import os
import re
import shutil
@ -187,22 +182,23 @@ def update_event_post(post_dir, event):
print("Event current: ", event.name, "({})".format(event.uid))
for event in list(cal.events):
def main():
for event in list(cal.events):
post_dir = os.path.join(output_dir, event.uid)
post_dir = os.path.join(output_dir, event.uid)
if event.uid not in existing_posts:
# if there is an event we dont already have, make it
create_event_post(post_dir, event)
if event.uid not in existing_posts:
# if there is an event we dont already have, make it
create_event_post(post_dir, event)
elif event.uid in existing_posts:
# if we already have it, update
update_event_post(post_dir, event)
existing_posts.remove(
event.uid
) # create list of posts which have not been returned by the calendar
elif event.uid in existing_posts:
# if we already have it, update
update_event_post(post_dir, event)
existing_posts.remove(
event.uid
) # create list of posts which have not been returned by the calendar
for post in existing_posts:
# remove events not returned by the calendar (deletion)
print("deleted", post)
shutil.rmtree(os.path.join(output_dir, post))
for post in existing_posts:
# remove events not returned by the calendar (deletion)
print("deleted", post)
shutil.rmtree(os.path.join(output_dir, post))