:feature: Mise en place de l'interface et de la configuration

This commit is contained in:
Orionis312050 committed 2026-10-09 21:25:46 +00:00
1 parent 6278d19618
commit 311ec74668
21 files changed
+1920 -231

No files matched your search

+12 -21
View File
@@ -1,25 +1,16 @@
from sqlalchemy.orm import Session
"""Legacy module.
from app.models import ApplicationSetting
Historically, MKVTool stored connection settings inside SQLite.
The project now externalises its configuration into ./config/conf.json.
This module is kept temporarily because some imports may still reference it.
"""
from app.conf_store import read_config
def read_setting(db: Session, key: str) -> str | None:
item = db.get(ApplicationSetting, key)
return item.value if item else None
def write_setting(db: Session, key: str, value: str) -> None:
item = db.get(ApplicationSetting, key)
if item:
item.value = value
else:
db.add(ApplicationSetting(key=key, value=value))
def radarr_credentials(db: Session) -> tuple[str, str]:
url = read_setting(db, "radarr_url")
api_key = read_setting(db, "radarr_api_key")
if not url or not api_key:
def radarr_credentials(_: object | None = None) -> tuple[str, str]:
cfg = read_config()
if not cfg.radarr.url or not cfg.radarr.api_key:
raise ValueError("La connexion Radarr n'est pas configurée")
return url.rstrip("/"), api_key
return cfg.radarr.url.rstrip("/"), cfg.radarr.api_key