cli commands
This commit is contained in:
@ -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))
|
||||
|
||||
Reference in New Issue
Block a user