its never done

This commit is contained in:
Georges-Antoine Assi
2026-03-07 22:55:20 -05:00
parent b4f3df57b3
commit 84a39005dc
2 changed files with 9 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ from .types import LAUNCHBOX_PLATFORMS_DIR
class LocalSource:
def __init__(self) -> None:
self._cache: dict[str, dict[str, dict[str, str]]] = {}
self._mtime: dict[str, int] = {}
async def get_rom(self, fs_name: str, platform_slug: str) -> dict[str, str] | None:
if not LAUNCHBOX_PLATFORMS_DIR.exists():
@@ -23,7 +24,10 @@ class LocalSource:
if not xml_path or not xml_path.exists():
return None
if platform_slug not in self._cache:
if (
platform_slug not in self._cache
or self._mtime.get(platform_slug) != xml_path.stat().st_mtime_ns
):
try:
indexed_val: dict[str, dict[str, str]] = {}
root = ET.parse(str(xml_path.resolve())).getroot()
@@ -50,6 +54,7 @@ class LocalSource:
return None
self._cache[platform_slug] = indexed_val
self._mtime[platform_slug] = xml_path.stat().st_mtime_ns
indexed_val = self._cache[platform_slug]

View File

@@ -203,7 +203,7 @@ def _get_cover(req: MediaRequest) -> str | None:
"Steam Poster",
)
# Remote media fallback (only if allowed)
# Remote media (overridden by local if available)
if req.remote_enabled and req.remote_images:
best_cover: dict | None = None
for image_type in cover_priority_types:
@@ -243,7 +243,7 @@ def _get_cover(req: MediaRequest) -> str | None:
def _get_screenshots(req: MediaRequest) -> list[str]:
screenshots: list[str] = []
# Remote media fallback (only if allowed)
# Remote media (overridden by local if available)
if req.remote_enabled and req.remote_images:
screenshots = [
f"https://images.launchbox-app.com/{image.get('FileName')}"
@@ -324,7 +324,7 @@ def _get_manuals(req: MediaRequest) -> str | None:
def _get_images(req: MediaRequest) -> list[LaunchboxImage]:
images: list[LaunchboxImage] = []
# Remote media fallback (only if allowed)
# Remote media (overridden by local if available)
if req.remote_enabled and req.remote_images:
images = [
LaunchboxImage(