From 079afeee7c7fc4d95ad2b67e6b2a9401c9e3d20a Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Thu, 16 Apr 2026 13:44:31 +0200 Subject: [PATCH] feat: create server/config with env var settings and quality presets Co-Authored-By: Claude Opus 4.6 --- server/__init__.py | 0 server/config.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 server/__init__.py create mode 100644 server/config.py diff --git a/server/__init__.py b/server/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/server/config.py b/server/config.py new file mode 100644 index 0000000..db43f1b --- /dev/null +++ b/server/config.py @@ -0,0 +1,21 @@ +import os +from pathlib import Path + + +MEDIA_DIRS: list[str] = [ + d.strip() for d in os.environ.get("MEDIA_DIRS", str(Path.home())).split(",") if d.strip() +] +EXPORT_DIR: str = os.environ.get("EXPORT_DIR", str(Path.home() / "8cut-exports")) +DB_PATH: str = os.environ.get("DB_PATH", str(Path.home() / ".8cut.db")) +CACHE_DIR: str = os.environ.get("CACHE_DIR", str(Path.home() / ".8cut-cache")) +HOST: str = os.environ.get("HOST", "0.0.0.0") +PORT: int = int(os.environ.get("PORT", "8000")) + +VIDEO_EXTENSIONS = {".mp4", ".mkv", ".avi", ".mov", ".webm", ".ts", ".flv", ".wmv"} + +QUALITY_PRESETS = { + "potato": {"height": 480, "bitrate": "500k"}, + "low": {"height": 720, "bitrate": "2M"}, + "medium": {"height": 1080, "bitrate": "5M"}, + "high": {"height": 0, "bitrate": "10M"}, # 0 = original resolution +}