This commit is contained in:
parent
64a3c729be
commit
3ad796ffb2
2 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from buba.animations.charset import BubaCharset
|
from buba.animations.charset import BubaCharset
|
||||||
|
@ -30,7 +31,11 @@ def setup_animations(config, animator: BubaAnimator):
|
||||||
ccchh_events = IcalEvents(animator.buba,
|
ccchh_events = IcalEvents(animator.buba,
|
||||||
url="https://cloud.hamburg.ccc.de/remote.php/dav/public-calendars/QJAdExziSnNJEz5g?export",
|
url="https://cloud.hamburg.ccc.de/remote.php/dav/public-calendars/QJAdExziSnNJEz5g?export",
|
||||||
title="CCCHH Events")
|
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(ccchh_events)
|
||||||
|
animator.add(ccc_events)
|
||||||
|
|
||||||
ccchh_spaceapi = Spaceapi(animator.buba, "https://spaceapi.hamburg.ccc.de", "CCCHH")
|
ccchh_spaceapi = Spaceapi(animator.buba, "https://spaceapi.hamburg.ccc.de", "CCCHH")
|
||||||
animator.add(ccchh_spaceapi)
|
animator.add(ccchh_spaceapi)
|
||||||
|
|
|
@ -11,17 +11,18 @@ from buba.bubacmd import BubaCmd
|
||||||
|
|
||||||
|
|
||||||
class IcalEvents(BubaAnimation):
|
class IcalEvents(BubaAnimation):
|
||||||
def __init__(self, buba, url, title):
|
def __init__(self, buba, url, title, range=timedelta(weeks=2)):
|
||||||
super().__init__(buba)
|
super().__init__(buba)
|
||||||
self.url = url
|
self.url = url
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.range = range
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<{type(self).__name__}, {self.url}>"
|
return f"<{type(self).__name__}, {self.url}>"
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
tz = timezone(os.getenv("TZ", "Europe/Berlin"))
|
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:
|
for event in events:
|
||||||
event.start = event.start.astimezone(tz)
|
event.start = event.start.astimezone(tz)
|
||||||
self.rows = [[e.summary, self.countdown(e.start)] for e in events]
|
self.rows = [[e.summary, self.countdown(e.start)] for e in events]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue