"""Filesystem paths and process-level constants. Every path is overridable through the environment so the test suite can point the whole application at a tmpdir without touching the real media tree. """ from __future__ import annotations import os from pathlib import Path def _path(env: str, default: str) -> Path: return Path(os.environ.get(env, default)) STATE_DIR = _path("YTA_STATE_DIR", "/var/lib/youtube-automate") MEDIA_ROOT = _path("YTA_MEDIA_ROOT", "/disks/Plex/YouTube") DB_PATH = _path("YTA_DB_PATH", str(STATE_DIR / "subs.db")) LOCK_PATH = _path("YTA_LOCK_PATH", str(STATE_DIR / "run.lock")) VENV_BIN = _path("YTA_VENV_BIN", str(STATE_DIR / "venv" / "bin")) WORK_DIR = MEDIA_ROOT / ".work" # Files created by the service must stay group-readable by `mediaserver`, which is # how Jellyfin reaches the tree. See specs.md ยง2. UMASK = 0o002 # Media-adjacent sidecars we own and therefore may delete on reap. SIDECAR_SUFFIXES = (".nfo", "-thumb.jpg", ".en.srt", ".info.json") USER_AGENT = "youtube-automate/1.0"