From b689e3bde1446f0ddf98bd41fd57fc7328b7bf2d Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sun, 19 Oct 2025 12:37:18 -0400 Subject: [PATCH] [ROMM-2531] Allow scanning without metadata providers --- backend/endpoints/sockets/scan.py | 11 +++-------- backend/handler/scan_handler.py | 4 ---- backend/tasks/scheduled/scan_library.py | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/backend/endpoints/sockets/scan.py b/backend/endpoints/sockets/scan.py index 87e6c730e..3332bb621 100644 --- a/backend/endpoints/sockets/scan.py +++ b/backend/endpoints/sockets/scan.py @@ -494,9 +494,9 @@ async def _identify_platform( @initialize_context() async def scan_platforms( platform_ids: list[int], + metadata_sources: list[str], scan_type: ScanType = ScanType.QUICK, roms_ids: list[int] | None = None, - metadata_sources: list[str] | None = None, ) -> ScanStats: """Scan all the listed platforms and fetch metadata from different sources @@ -513,11 +513,6 @@ async def scan_platforms( socket_manager = _get_socket_manager() scan_stats = ScanStats() - if not metadata_sources: - log.error("No metadata sources provided") - await socket_manager.emit("scan:done_ko", "No metadata sources provided") - return scan_stats - try: fs_platforms: list[str] = await fs_platform_handler.get_platforms() except FolderStructureNotMatchException as e: @@ -603,17 +598,17 @@ async def scan_handler(_sid: str, options: dict[str, Any]): if DEV_MODE: return await scan_platforms( platform_ids=platform_ids, + metadata_sources=metadata_sources, scan_type=scan_type, roms_ids=roms_ids, - metadata_sources=metadata_sources, ) return high_prio_queue.enqueue( scan_platforms, platform_ids, + metadata_sources, scan_type, roms_ids, - metadata_sources, job_timeout=SCAN_TIMEOUT, # Timeout (default of 4 hours) result_ttl=TASK_RESULT_TTL, meta={ diff --git a/backend/handler/scan_handler.py b/backend/handler/scan_handler.py index 6f0a8c999..7268d1e53 100644 --- a/backend/handler/scan_handler.py +++ b/backend/handler/scan_handler.py @@ -286,10 +286,6 @@ async def scan_rom( newly_added: bool, socket_manager: socketio.AsyncRedisManager | None = None, ) -> Rom: - if not metadata_sources: - log.error("No metadata sources provided") - raise ValueError("No metadata sources provided") - filesize = sum([file.file_size_bytes for file in fs_rom["files"]]) rom_attrs = { "platform_id": platform.id, diff --git a/backend/tasks/scheduled/scan_library.py b/backend/tasks/scheduled/scan_library.py index 75408288e..07ac4ee2e 100644 --- a/backend/tasks/scheduled/scan_library.py +++ b/backend/tasks/scheduled/scan_library.py @@ -61,7 +61,7 @@ class ScanLibraryTask(PeriodicTask): log.info("Scheduled library scan started...") scan_stats = await scan_platforms( - [], scan_type=ScanType.UNIDENTIFIED, metadata_sources=metadata_sources + [], metadata_sources=metadata_sources, scan_type=ScanType.UNIDENTIFIED ) log.info("Scheduled library scan done")