Sky and ISS views
Two new views, picked from mockups. `sky`: a star chart of the sky over Zlín as seen lying on your back, with the planets, the moon in its phase, tonight's darkness, cloud for the next 12 hours and the next visible ISS pass. `iss`: a dotted world map with day and night, the ISS and its ground track, and the next pass over Zlín with the cloud cover for that hour. Positions are calculated locally with ephem; only the ISS orbit (CelesTrak, every 6 h, retried gently) and cloud cover (Open-Meteo) are fetched. The poller gained a per-source retry delay for that. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6c9a1420d2
commit
2132262896
28 files changed
+1342
-18
No files matched your search
+21
@@ -1,8 +1,11 @@
|
||||
"""The views the container can show, selected by the VIEW env var."""
|
||||
from typing import Callable
|
||||
|
||||
from iss_view import IssView
|
||||
from poller import Poller
|
||||
from server_view import ServerView
|
||||
from sky_data import fetch_clouds, fetch_tle
|
||||
from sky_view import SkyView
|
||||
from stats_data import StatsReader
|
||||
from timeutil import local_now
|
||||
from view import View
|
||||
@@ -11,6 +14,9 @@ from weather_view import WeatherView
|
||||
|
||||
WEATHER_REFRESH_S = 15 * 60
|
||||
SERVER_REFRESH_S = 1
|
||||
TLE_REFRESH_S = 6 * 3600 # CelesTrak updates the elements a few times a day and asks not to be polled hard
|
||||
TLE_RETRY_S = 30 * 60
|
||||
CLOUDS_REFRESH_S = 15 * 60
|
||||
|
||||
|
||||
class UnknownView(Exception):
|
||||
@@ -28,10 +34,25 @@ def _server() -> View:
|
||||
return ServerView(Poller(StatsReader().read, SERVER_REFRESH_S))
|
||||
|
||||
|
||||
def _sky_pollers() -> tuple[Poller, Poller]:
|
||||
return (Poller(fetch_tle, TLE_REFRESH_S, retry=TLE_RETRY_S),
|
||||
Poller(fetch_clouds, CLOUDS_REFRESH_S))
|
||||
|
||||
|
||||
def _sky() -> View:
|
||||
return SkyView(*_sky_pollers())
|
||||
|
||||
|
||||
def _iss() -> View:
|
||||
return IssView(*_sky_pollers())
|
||||
|
||||
|
||||
# To add a view: write the module, add one entry here, add a README line.
|
||||
REGISTRY: dict[str, Callable[[], View]] = {
|
||||
"weather": _weather,
|
||||
"server": _server,
|
||||
"sky": _sky,
|
||||
"iss": _iss,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user