Files
jellyfin-scene-search/scene_search/config.py
T
2026-10-06 14:42:10 +01:00

48 lines
1.5 KiB
Python

from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
@dataclass(frozen=True)
class Settings:
meili_url: str = os.getenv("MEILI_URL", "http://127.0.0.1:7700").rstrip("/")
meili_master_key: str = os.getenv("MEILI_MASTER_KEY", "change-me-now")
meili_index: str = os.getenv("MEILI_INDEX", "jellyfin_scenes")
hybrid_semantic_ratio: float = float(os.getenv("HYBRID_SEMANTIC_RATIO", "0.80"))
model_id: str = os.getenv("MODEL_ID", "google/siglip2-base-patch16-224")
device: str = os.getenv("DEVICE", "cuda")
batch_size: int = int(os.getenv("BATCH_SIZE", "8"))
ollama_url: str = os.getenv("OLLAMA_URL", "http://127.0.0.1:11434").rstrip("/")
caption_model: str = os.getenv(
"CAPTION_MODEL",
"huihui_ai/qwen3-vl-abliterated:4b-instruct-q4_K_M",
)
caption_timeout_seconds: int = int(os.getenv("CAPTION_TIMEOUT_SECONDS", "180"))
caption_max_tokens: int = int(os.getenv("CAPTION_MAX_TOKENS", "120"))
caption_prompt_file: Path = Path(
os.getenv("CAPTION_PROMPT_FILE", "./data/caption_prompt.txt")
).expanduser().resolve()
data_dir: Path = Path(os.getenv("DATA_DIR", "./data")).resolve()
@property
def db_path(self) -> Path:
return self.data_dir / "scenes.sqlite3"
@property
def thumbs_dir(self) -> Path:
return self.data_dir / "thumbs"
settings = Settings()
settings.data_dir.mkdir(parents=True, exist_ok=True)
settings.thumbs_dir.mkdir(parents=True, exist_ok=True)