feat(ui): SoC Refactoring & Config Validation
- Theme Context ausgelagert (ThemeContext.tsx + useDarkMode.ts) - Config Validation mit TMDB-API-Key Pflicht (config_validation.py) - Cache Key Centralization (cache/keys.py) - CD-Ripping mit abcde implementiert (Worker) - Docker Compose mit Healthchecks & LOG_LEVEL - ROADMAP.md & SAVEPOINT.md aktualisiert
This commit is contained in:
@@ -6,12 +6,38 @@ import json
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from cache.keys import PRESCAN_AUDIO_PREFIX, PRESCAN_VIDEO_PREFIX, CONFIRMED_METADATA_PREFIX
|
||||
|
||||
CACHE_DIR = Path("/app/cache")
|
||||
CACHE_FILE = CACHE_DIR / "api_cache.db"
|
||||
MAX_ENTRIES = 10000
|
||||
DEFAULT_TTL = 86400 # 24 Stunden
|
||||
|
||||
|
||||
def is_prescan_key(key: str) -> bool:
|
||||
"""Prüfe ob Key ein Pre-Scan-Key ist."""
|
||||
return key.startswith(PRESCAN_AUDIO_PREFIX) or key.startswith(PRESCAN_VIDEO_PREFIX)
|
||||
|
||||
|
||||
def is_confirmed_key(key: str) -> bool:
|
||||
"""Prüfe ob Key ein bestätigter Metadaten-Key ist."""
|
||||
return key.startswith(CONFIRMED_METADATA_PREFIX)
|
||||
|
||||
|
||||
def get_cache_category(key: str) -> str:
|
||||
"""Ermittle Kategorie eines Cache-Keys."""
|
||||
if is_prescan_key(key):
|
||||
return "prescan"
|
||||
elif is_confirmed_key(key):
|
||||
return "confirmed"
|
||||
elif key.startswith("tmdb:"):
|
||||
return "tmdb"
|
||||
elif key.startswith("musicbrainz:"):
|
||||
return "musicbrainz"
|
||||
return "other"
|
||||
|
||||
|
||||
|
||||
def init_cache() -> None:
|
||||
"""Initialisiere Cache-DB."""
|
||||
CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user