cal: fix post deletion logic

This commit is contained in:
knoflook 2022-02-07 11:50:41 +01:00
parent 58024c775a
commit 40bf9416b8
Signed by: knoflook
GPG Key ID: D6A1D0E8FC4FEF1C

View File

@ -193,18 +193,18 @@ def update_event_post(post_dir, event):
def main():
for event in list(cal.events):
post_name = sanitize_name(event.name) + "-" + event.uid
post_dir = os.path.join(output_dir, post_name)
post_dir = os.path.join(output_dir, sanitize_name(event.name) + "-" + event.uid)
if event.uid not in existing_posts:
if post_name 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:
elif post_name in existing_posts:
# if we already have it, update
update_event_post(post_dir, event)
existing_posts.remove(
event.uid
post_name
) # create list of posts which have not been returned by the calendar
for post in existing_posts: