commit
This commit is contained in:
@@ -113,4 +113,3 @@ import streamlit as st
|
||||
cal_df = load_csv(CALENDAR_FILE, CALENDAR_COLUMNS)
|
||||
st.dataframe(cal_df, use_container_width=True)
|
||||
st.download_button("Kalender CSV herunterladen", data=cal_df.to_csv(index=False).encode("utf-8"), file_name="calendar.csv", mime="text/csv")
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
id,titel,datum,uhrzeit,dauer_min,kalender,kategorie,erinnerung_min,wiederholen,notiz
|
||||
1,Horror Game (Sprint 0-1),2026-08-26,17:00,180,Arbeit,Meeting,30,Täglich,"Game muss entwickelt werden, Fokus AN."
|
||||
2,Gym,2026-08-26,13:00,60,Privat,Aufgabe,0,Täglich,Gesundheit
|
||||
3,Yupin zur Arbeit fahren,2026-08-26,15:30,45,Privat,Aufgabe,15,Täglich,"Freundin zur Arbeit mit dem Roller fahren, danach kann Kleinigkeit im Big C gekauft werden."
|
||||
4,Bitcoin pflegen,2026-08-31,12:00,60,Todo,Erinnerung,0,Wöchentlich,"Bitcoin lokal wissen aufbauen, Endresultat aktuelles Chart mit allen werten Blabla"
|
||||
5,Pattaya Marathon 2026,2026-09-27,04:00,240,Privat,Aufgabe,60,Nein,one Marathon one year older
|
||||
6,Reminder Call Family,2026-08-29,13:00,30,Privat,Aufgabe,0,Wöchentlich,
|
||||
7,Geburtstag Dominik Schaefer,2026-09-02,00:00,60,Privat,Erinnerung,0,Nein,"mein Geburtstag, werde 27 Jahre alt."
|
||||
8,Yupins Geburtstag,2026-09-16,00:00,60,Privat,Erinnerung,0,Nein,"Was besonderes unternehmen, Essen gehen, Shoppen. "
|
||||
9,Stichtag für die Wohnung (Miete / Nebenkosten),2026-09-05,00:00,1440,Privat,Aufgabe,0,Monatlich,
|
||||
10,Rechnung für den Kredit ,2026-08-30,00:00,15,Bitcoin,Aufgabe,0,Monatlich,
|
||||
11,Rechnung für den BTC-Kredit über 3.200€,2026-09-30,00:00,1440,Bitcoin,Aufgabe,10080,Nein,"firefish.io 0,10 btc"
|
||||
|
@@ -0,0 +1,83 @@
|
||||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//Hermes Agent//Calendar Exporter//DE
|
||||
CALSCALE:GREGORIAN
|
||||
METHOD:PUBLISH
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-6854749454929450610@local
|
||||
DTSTART:20260826T090000
|
||||
DTEND:20260826T100000
|
||||
SUMMARY:Horror Game (Sprint 0-1)
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-7102422966172142631@local
|
||||
DTSTART:20260826T090000
|
||||
DTEND:20260826T100000
|
||||
SUMMARY:Gym
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-9140946676080998345@local
|
||||
DTSTART:20260826T090000
|
||||
DTEND:20260826T100000
|
||||
SUMMARY:Yupin zur Arbeit fahren
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-2877415102198682578@local
|
||||
DTSTART:20260831T090000
|
||||
DTEND:20260831T100000
|
||||
SUMMARY:Bitcoin pflegen
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-3211100783371897941@local
|
||||
DTSTART:20260927T090000
|
||||
DTEND:20260927T100000
|
||||
SUMMARY:Pattaya Marathon 2026
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-1365960028236796904@local
|
||||
DTSTART:20260829T090000
|
||||
DTEND:20260829T100000
|
||||
SUMMARY:Reminder Call Family
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-4380767364730211534@local
|
||||
DTSTART:20260902T090000
|
||||
DTEND:20260902T100000
|
||||
SUMMARY:Geburtstag Dominik Schaefer
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-1504447817045986540@local
|
||||
DTSTART:20260916T090000
|
||||
DTEND:20260916T100000
|
||||
SUMMARY:Yupins Geburtstag
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-1352647901544740608@local
|
||||
DTSTART:20260905T090000
|
||||
DTEND:20260905T100000
|
||||
SUMMARY:Stichtag für die Wohnung (Miete / Nebenkosten)
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-8717647521268059452@local
|
||||
DTSTART:20260830T090000
|
||||
DTEND:20260830T100000
|
||||
SUMMARY:Rechnung für den Kredit
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:hermes-7306110145677903484@local
|
||||
DTSTART:20260930T090000
|
||||
DTEND:20260930T100000
|
||||
SUMMARY:Rechnung für den BTC-Kredit über 3.200€
|
||||
DESCRIPTION:
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
@@ -0,0 +1,85 @@
|
||||
import csv
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
csv_file = 'data/calendar.csv'
|
||||
ics_file = 'data/calendar.ics'
|
||||
if not os.path.exists(csv_file):
|
||||
print(f"Error: {csv_file} not found. Please ensure your CSV is located at {csv_file}.")
|
||||
exit(1)
|
||||
ics_lines = [
|
||||
"BEGIN:VCALENDAR",
|
||||
"VERSION:2.0",
|
||||
"PRODID:-//Hermes Agent//Calendar Exporter//DE",
|
||||
"CALSCALE:GREGORIAN",
|
||||
"METHOD:PUBLISH"
|
||||
]
|
||||
days_map = {
|
||||
"montag": "MO", "dienstag": "TU", "mittwoch": "WE", "donnerstag": "TH",
|
||||
"freitag": "FR", "samstag": "SA", "sonntag": "SU"
|
||||
}
|
||||
with open(csv_file, mode='r', encoding='utf-8') as f:
|
||||
reader = csv.DictReader(f)
|
||||
for row in reader:
|
||||
title = row.get("titel", "Termin")
|
||||
time_str = row.get("zeit", "09:00")
|
||||
rhythm = row.get("wochentag", "").strip().lower()
|
||||
date_str = row.get("datum", "").strip()
|
||||
desc = row.get("beschreibung", "")
|
||||
# Zeit parsen
|
||||
try:
|
||||
hour, minute = map(int, time_str.split(":"))
|
||||
except:
|
||||
hour, minute = 9, 0
|
||||
uid = f"hermes-{abs(hash(title + time_str + rhythm + date_str))}@local"
|
||||
|
||||
if rhythm == "täglich":
|
||||
start_dt = datetime.now().replace(hour=hour, minute=minute, second=0, microsecond=0)
|
||||
start_str = start_dt.strftime("%Y%m%dT%H%M%S")
|
||||
end_str = (start_dt + timedelta(hours=1)).strftime("%Y%m%dT%H%M%S")
|
||||
|
||||
ics_lines.extend([
|
||||
"BEGIN:VEVENT",
|
||||
f"UID:{uid}",
|
||||
f"DTSTART:{start_str}",
|
||||
f"DTEND:{end_str}",
|
||||
f"SUMMARY:{title}",
|
||||
f"DESCRIPTION:{desc}",
|
||||
"RRULE:FREQ=DAILY",
|
||||
"END:VEVENT"
|
||||
])
|
||||
elif rhythm in days_map:
|
||||
start_dt = datetime.now().replace(hour=hour, minute=minute, second=0, microsecond=0)
|
||||
start_str = start_dt.strftime("%Y%m%dT%H%M%S")
|
||||
end_str = (start_dt + timedelta(hours=1)).strftime("%Y%m%dT%H%M%S")
|
||||
byday = days_map[rhythm]
|
||||
|
||||
ics_lines.extend([
|
||||
"BEGIN:VEVENT",
|
||||
f"UID:{uid}",
|
||||
f"DTSTART:{start_str}",
|
||||
f"DTEND:{end_str}",
|
||||
f"SUMMARY:{title}",
|
||||
f"DESCRIPTION:{desc}",
|
||||
f"RRULE:FREQ=WEEKLY;BYDAY={byday}",
|
||||
"END:VEVENT"
|
||||
])
|
||||
elif date_str:
|
||||
try:
|
||||
dt = datetime.strptime(date_str, "%Y-%m-%d").replace(hour=hour, minute=minute)
|
||||
start_str = dt.strftime("%Y%m%dT%H%M%S")
|
||||
end_str = (dt + timedelta(hours=1)).strftime("%Y%m%dT%H%M%S")
|
||||
ics_lines.extend([
|
||||
"BEGIN:VEVENT",
|
||||
f"UID:{uid}",
|
||||
f"DTSTART:{start_str}",
|
||||
f"DTEND:{end_str}",
|
||||
f"SUMMARY:{title}",
|
||||
f"DESCRIPTION:{desc}",
|
||||
"END:VEVENT"
|
||||
])
|
||||
except Exception as e:
|
||||
print(f"Skipping row due to date parse error: {row} ({e})")
|
||||
ics_lines.append("END:VCALENDAR")
|
||||
with open(ics_file, mode='w', encoding='utf-8') as f:
|
||||
f.write("\n".join(ics_lines))
|
||||
print(f"Erfolgreich generiert: {ics_file}")
|
||||
Reference in New Issue
Block a user