"keep data on the server" opt-in/out
This commit is contained in:
@@ -10,7 +10,6 @@ from __future__ import annotations
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
from bincio.extract.models import ParsedActivity
|
||||
|
||||
|
||||
@@ -67,6 +66,7 @@ def strava_sync(
|
||||
data_dir: Path,
|
||||
client_id: str,
|
||||
client_secret: str,
|
||||
originals_dir: Optional[Path] = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Fetch new Strava activities and ingest them into data_dir.
|
||||
|
||||
@@ -119,6 +119,12 @@ def strava_sync(
|
||||
skipped += 1
|
||||
continue
|
||||
streams = fetch_streams(token["access_token"], meta["id"])
|
||||
if originals_dir is not None:
|
||||
orig_path = originals_dir / f"{activity_id}.json"
|
||||
orig_path.write_text(
|
||||
json.dumps({"meta": meta, "streams": streams}, indent=2),
|
||||
encoding="utf-8",
|
||||
)
|
||||
parsed = strava_to_parsed(meta, streams)
|
||||
ingest_parsed(parsed, data_dir, privacy="public", rdp_epsilon=0.0001)
|
||||
imported += 1
|
||||
|
||||
Reference in New Issue
Block a user