1"""Paths, binary discovery, and run-name conventions for the webviewer backend."""
3from __future__
import annotations
8from pathlib
import Path
12 os.environ.get(
"ELODIN_DB_DIR", str(Path.home() /
".local/share/elodin"))
19 "WEBVIEWER_CACHE_DIR", str(Path(__file__).resolve().parent.parent /
".cache")
28RUN_RE = re.compile(
r"^daq_(?P<sim>sim_)?(?P<date>\d{8})_(?P<time>\d{6})$")
35DESCRIPTIONS_PATH = Path(
36 os.environ.get(
"WEBVIEWER_DESCRIPTIONS_PATH", str(ELODIN_DIR /
"run_descriptions.json"))
41_video = os.environ.get(
"WEBVIEWER_VIDEO_DIR",
"").strip()
42VIDEO_DIR: Path |
None = Path(_video).expanduser()
if _video
else None
46VIDEO_TZ = os.environ.get(
"WEBVIEWER_VIDEO_TZ",
"America/Los_Angeles")
53MAX_DOWNLOAD_BYTES_PER_SEC = int(os.environ.get(
"WEBVIEWER_MAX_DOWNLOAD_BPS",
"0"))
57 """Locate the elodin-db binary the same way export_elodin_db.sh does."""
58 cargo = Path.home() /
".cargo/bin/elodin-db"
61 found = shutil.which(
"elodin-db")
65 "elodin-db not found. Install with `cargo install elodin-db` or put it on PATH."