25 lines
725 B
Python
25 lines
725 B
Python
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class AppSettings(BaseSettings):
|
|
config_dir: Path = Path("./config")
|
|
database_url: str | None = None
|
|
films_dir: Path = Path("./films")
|
|
downloads_dir: Path = Path("./downloads")
|
|
# Simulation (dev/tests): produit un faux MKV au lieu d'appeler MakeMKV.
|
|
simulate_conversion: bool = True
|
|
worker_interval: float = 10.0
|
|
|
|
model_config = SettingsConfigDict(env_prefix="MKVTOOL_", env_file=".env")
|
|
|
|
@property
|
|
def resolved_database_url(self) -> str:
|
|
if self.database_url:
|
|
return self.database_url
|
|
return f"sqlite:///{self.config_dir / 'mkvtool.db'}"
|
|
|
|
|
|
settings = AppSettings()
|