Added support for removing events in calendar
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
ca7f8629ac
commit
69f0ab5661
|
@ -1,6 +1,8 @@
|
|||
1.0.2
|
||||
-----
|
||||
|
||||
* added support for removing events in the calendar
|
||||
(achieved by deleting all event files prior to creating them)
|
||||
* added changes.txt file (including changes for 1.0.1)
|
||||
|
||||
1.0.1
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
"""calendarsync.calendarsync: provides entry point main()"""
|
||||
import argparse
|
||||
import datetime
|
||||
import glob
|
||||
import os
|
||||
from os.path import isdir
|
||||
|
||||
import pkg_resources
|
||||
|
@ -53,6 +55,12 @@ def sync(calendar_url: str, event_collection_path: str) -> None:
|
|||
)
|
||||
with open(template_filename, 'r', encoding='utf-8') as template:
|
||||
template_content = template.read()
|
||||
|
||||
# remove previous event files in directory to allow the removal of events in calendar
|
||||
files = glob.glob(event_collection_path + '*.markdown')
|
||||
for file in files:
|
||||
os.remove(file)
|
||||
|
||||
for event in calendar.events:
|
||||
event_content = template_content.replace('<name>', event.name)
|
||||
created: datetime.datetime = event.created
|
||||
|
|
Loading…
Reference in New Issue