Run autoformat, Add readme

This commit is contained in:
Kai Vogelgesang 2023-05-18 03:10:34 +02:00
parent d1b8839dba
commit f973938f53
Signed by: kai
GPG Key ID: 3FC8578CC818A9EB
5 changed files with 15 additions and 8 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# 🛰️ Sat-Kalender

View File

@ -34,7 +34,9 @@ class Pass:
summary += " [!]"
description = []
description.append(f"Azimuth: {self.start_az} ({self.start_compass}) to {self.end_az} ({self.end_compass})")
description.append(
f"Azimuth: {self.start_az} ({self.start_compass}) to {self.end_az} ({self.end_compass})"
)
description.append("")
description.append("Downlinks:")
for downlink in self.downlinks:

View File

@ -86,10 +86,11 @@ class N2YO:
return RadioPasses.parse_obj(response)
@asynccontextmanager
async def n2yo_api(key: str):
api = N2YO(key)
try:
yield api
finally:
await api.client.close()
await api.client.close()

View File

@ -4,10 +4,12 @@ from pydantic import BaseModel
from .settings import settings
class Downlink(BaseModel):
proto: str
freq: float
class Satellite(BaseModel):
name: str
downlink: list[Downlink]
@ -17,7 +19,4 @@ def read_satellites() -> dict[int, Satellite]:
with open(settings.satellites_file, "rb") as f:
data = tomllib.load(f)
return {
int(k): Satellite.parse_obj(v)
for k, v in data.items()
}
return {int(k): Satellite.parse_obj(v) for k, v in data.items()}

View File

@ -1,5 +1,6 @@
from pydantic import BaseSettings, BaseModel
class Observer(BaseModel):
latitude: float
longitude: float
@ -7,19 +8,22 @@ class Observer(BaseModel):
min_elevation: int = 15
good_elevation: int = 50
class CalDav(BaseModel):
uri: str
username: str
password: str
class Settings(BaseSettings):
n2yo_api_key: str
satellites_file: str = "satellites.toml"
observer: Observer
caldav: CalDav
class Config:
env_file = ".env"
env_nested_delimiter = '_'
env_nested_delimiter = "_"
settings = Settings()