Added support for removing events in calendar
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
@ -1,6 +1,8 @@
|
|||||||
1.0.2
|
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)
|
* added changes.txt file (including changes for 1.0.1)
|
||||||
|
|
||||||
1.0.1
|
1.0.1
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
"""calendarsync.calendarsync: provides entry point main()"""
|
"""calendarsync.calendarsync: provides entry point main()"""
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
from os.path import isdir
|
from os.path import isdir
|
||||||
|
|
||||||
import pkg_resources
|
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:
|
with open(template_filename, 'r', encoding='utf-8') as template:
|
||||||
template_content = template.read()
|
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:
|
for event in calendar.events:
|
||||||
event_content = template_content.replace('<name>', event.name)
|
event_content = template_content.replace('<name>', event.name)
|
||||||
created: datetime.datetime = event.created
|
created: datetime.datetime = event.created
|
||||||
|
|||||||
Reference in New Issue
Block a user