1) download the ics file
- sudo apt install python3-pip
- sudo pip3 install ics
- create the bash executable file, like this
se avete google
#!/bin/bash
wget -O diario.ics https://calendar.google.com/calendar/ical/[remote path]/basic.ics
se avete nextcloud
wget -O diario.ics https://ecloud.global/remote.php/dav/calendars/[vostra user(ad esempio la mail]/personal/?export –user=[il vostro user, come prima]–password=[la vostra password]
2) convert the ics to md
afterwards, after downloading the ics file (in the following example “personal.ics”) you have to concert it to a md file. You can use a code like the folowing, in a python file (we call here “convert-ics.py”) located or linked in the same folder of ics file:
from ics import Calendar
md_template = """
## {name} - {start}
{desc}
{location}
_{categ}_"""
with open("personal.ics") as f:
cal = Calendar(f.read())
print("# Diario")
for e in sorted(cal.events):
print(md_template.format(start=e.begin.strftime("%Y-%m-%e"), name=e.name,
desc=e.description, location=e.location,
categ=e.categories))
and then
python3 convert-ics.py > /[local-path]/local-file.md