From a8d36a55b0506cddbc9ca5131b292c8da2167144 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 23 Nov 2023 22:05:05 +0000 Subject: [PATCH] Space launches with known dates in the calendar Closes: #71 --- agenda/data.py | 11 +++++++++++ agenda/thespacedevs.py | 2 ++ 2 files changed, 13 insertions(+) diff --git a/agenda/data.py b/agenda/data.py index 566801c..32c56f7 100644 --- a/agenda/data.py +++ b/agenda/data.py @@ -264,6 +264,17 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]: events += domains.renewal_dates(my_data) + for launch in rockets: + if not launch["t0_time"]: + continue + dt = pytz.utc.localize(datetime.strptime(launch["net"], "%Y-%m-%dT%H:%M:%SZ")) + e = Event( + name="rocket", + date=dt, + title=f'🚀{launch["rocket"]}: {launch["mission"]["name"]}', + ) + events.append(e) + events.sort(key=operator.attrgetter("as_datetime")) observer = sun.bristol() diff --git a/agenda/thespacedevs.py b/agenda/thespacedevs.py index b7260a8..838ad1d 100644 --- a/agenda/thespacedevs.py +++ b/agenda/thespacedevs.py @@ -94,6 +94,8 @@ def summarize_launch(launch: Launch) -> Summary: return { "name": launch["name"], "status": launch["status"], + "net": launch["net"], + "net_precision": launch["net_precision"]["name"], "t0_date": t0_date, "t0_time": t0_time, "window_start": launch["window_start"],