fix uid in ical

This commit is contained in:
fram3d 2024-02-08 17:19:13 +01:00
parent 35198a33d2
commit 4d4fd6d4d3
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
2 changed files with 3 additions and 1 deletions

View File

@ -60,10 +60,12 @@ def build_ical(events: list[dict]) -> str:
created = str(today.year) + str(today.month).zfill(2) + str(today.day).zfill(2) + "T" + str(today.hour).zfill(2) + str(today.minute).zfill(2) + str(today.second).zfill(2) + "Z" created = str(today.year) + str(today.month).zfill(2) + str(today.day).zfill(2) + "T" + str(today.hour).zfill(2) + str(today.minute).zfill(2) + str(today.second).zfill(2) + "Z"
time = event["time"] time = event["time"]
date = date + "T" + time.replace(":", "") + "00" date = date + "T" + time.replace(":", "") + "00"
uid = str(date.month).zfill(2) + str(date.day).zfill(2) + time[:2]
event_template = "" event_template = ""
with open("template/event.ical", "r") as file: with open("template/event.ical", "r") as file:
event_template += file.read() event_template += file.read()
event_template = event_template.replace("<!--UID-->", uid)
event_template = event_template.replace("<!--CREATED-->", created) event_template = event_template.replace("<!--CREATED-->", created)
event_template = event_template.replace("<!--DATE-->", date) event_template = event_template.replace("<!--DATE-->", date)
event_template = event_template.replace("<!--TITLE-->", title) event_template = event_template.replace("<!--TITLE-->", title)

View File

@ -1,5 +1,5 @@
BEGIN:VEVENT BEGIN:VEVENT
UID:calendar.462701.field_date_time.0@radar.squat.net UID:calendar.<!--UID-->.field_date_time.0@radar.squat.net
DTSTAMP:<!--CREATED--> DTSTAMP:<!--CREATED-->
CREATED:<!--CREATED--> CREATED:<!--CREATED-->
DTSTART;TZID=Europe/Belgrade:<!--DATE--> DTSTART;TZID=Europe/Belgrade:<!--DATE-->