From 3ad796ffb2a2f6522747393d3e1b81cf337138d5 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Mon, 16 Jun 2025 09:40:08 +0200 Subject: [PATCH] Add CCC events --- buba/animationconfig.py | 5 +++++ buba/animations/icalevents.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/buba/animationconfig.py b/buba/animationconfig.py index 960f74d..a964515 100644 --- a/buba/animationconfig.py +++ b/buba/animationconfig.py @@ -1,3 +1,4 @@ +import datetime import logging from buba.animations.charset import BubaCharset @@ -30,7 +31,11 @@ def setup_animations(config, animator: BubaAnimator): ccchh_events = IcalEvents(animator.buba, url="https://cloud.hamburg.ccc.de/remote.php/dav/public-calendars/QJAdExziSnNJEz5g?export", title="CCCHH Events") + ccc_events = IcalEvents(animator.buba, + url="https://events.ccc.de/calendar/events.ics", + title="CCC Events", range=datetime.timedelta(weeks=8)) animator.add(ccchh_events) + animator.add(ccc_events) ccchh_spaceapi = Spaceapi(animator.buba, "https://spaceapi.hamburg.ccc.de", "CCCHH") animator.add(ccchh_spaceapi) diff --git a/buba/animations/icalevents.py b/buba/animations/icalevents.py index e905276..3464bd9 100644 --- a/buba/animations/icalevents.py +++ b/buba/animations/icalevents.py @@ -11,17 +11,18 @@ from buba.bubacmd import BubaCmd class IcalEvents(BubaAnimation): - def __init__(self, buba, url, title): + def __init__(self, buba, url, title, range=timedelta(weeks=2)): super().__init__(buba) self.url = url self.title = title + self.range = range def __repr__(self): return f"<{type(self).__name__}, {self.url}>" def update(self): tz = timezone(os.getenv("TZ", "Europe/Berlin")) - events = icalevents.icalevents.events(self.url, tzinfo=tz, sort=True, end=datetime.now(tz) + timedelta(days=14)) + events = icalevents.icalevents.events(self.url, tzinfo=tz, sort=True, end=datetime.now(tz) + self.range) for event in events: event.start = event.start.astimezone(tz) self.rows = [[e.summary, self.countdown(e.start)] for e in events]