mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
[ROMM-2531] Allow scanning without metadata providers
This commit is contained in:
@@ -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={
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user