improve configs, update docs

This commit is contained in:
Davide Scaini
2026-03-30 13:30:43 +02:00
parent a65923c3e0
commit d806072546
14 changed files with 799 additions and 109 deletions
+14
View File
@@ -27,6 +27,12 @@ class ClassifierConfig:
enabled: bool = False # off by default; opt-in
@dataclass
class StravaConfig:
client_id: str = ""
client_secret: str = ""
@dataclass
class AthleteConfig:
max_hr: int | None = None
@@ -48,6 +54,7 @@ class ExtractConfig:
owner_handle: str = "me"
owner_display_name: str = "Me"
athlete: AthleteConfig | None = None
strava: StravaConfig | None = None
def load_config(path: Path) -> ExtractConfig:
@@ -87,6 +94,12 @@ def load_config(path: Path) -> ExtractConfig:
power_zones=ath_raw.get("power_zones"),
) if ath_raw else None
strava_raw = (raw.get("import") or {}).get("strava") or {}
strava = StravaConfig(
client_id=str(strava_raw["client_id"]) if strava_raw.get("client_id") else "",
client_secret=str(strava_raw["client_secret"]) if strava_raw.get("client_secret") else "",
) if strava_raw else None
return ExtractConfig(
input_dirs=dirs,
output_dir=out,
@@ -99,6 +112,7 @@ def load_config(path: Path) -> ExtractConfig:
owner_handle=owner.get("handle", "me"),
owner_display_name=owner.get("display_name", "Me"),
athlete=athlete,
strava=strava,
)