parent
9a79573e16
commit
6ac998833c
|
@ -13,6 +13,7 @@ from typing import List
|
|||
import dateutil
|
||||
import dateutil.parser
|
||||
import dateutil.tz
|
||||
import ephem
|
||||
import exchange_calendars
|
||||
import holidays
|
||||
import lxml
|
||||
|
@ -593,6 +594,22 @@ def waste_collection_events() -> list[Event]:
|
|||
return events
|
||||
|
||||
|
||||
def bristol():
|
||||
observer = ephem.Observer()
|
||||
observer.lat, observer.lon = "51.4545", "-2.5879"
|
||||
return observer
|
||||
|
||||
|
||||
def sunrise(observer):
|
||||
"""Sunrise."""
|
||||
return observer.next_rising(ephem.Sun(observer)).datetime()
|
||||
|
||||
|
||||
def sunset(observer):
|
||||
"""Sunrise."""
|
||||
return observer.next_setting(ephem.Sun(observer)).datetime()
|
||||
|
||||
|
||||
def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
||||
"""Get data to display on agenda dashboard."""
|
||||
rocket_dir = os.path.join(data_dir, "thespacedevs")
|
||||
|
@ -634,6 +651,10 @@ def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
|||
event = Event(name=key, date=value)
|
||||
events.append(event)
|
||||
|
||||
observer = bristol()
|
||||
reply["sunrise"] = sunrise(observer)
|
||||
reply["sunset"] = sunset(observer)
|
||||
|
||||
for key, value in xmas_last_posting_dates.items():
|
||||
events.append(Event(name=f"xmas_last_{key}", date=value))
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
unknown
|
||||
{% endif %}
|
||||
</li>
|
||||
<li>Sunrise: {{ sunrise.strftime("%H:%M:%S") }} /
|
||||
Sunset: {{ sunset.strftime("%H:%M:%S") }}</li>
|
||||
</ul>
|
||||
|
||||
<table class="table table-hover w-auto">
|
||||
|
|
Loading…
Reference in a new issue