Skip to content

Commit

Permalink
Refactor scan functions to use MetadataSource enum for metadata sources
Browse files Browse the repository at this point in the history
  • Loading branch information
zurdi15 committed Feb 6, 2025
1 parent 2393e1e commit d96239c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions backend/endpoints/sockets/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
)
from handler.filesystem.roms_handler import FSRom
from handler.redis_handler import high_prio_queue, low_prio_queue, redis_client
from handler.scan_handler import ScanType, scan_firmware, scan_platform, scan_rom
from handler.scan_handler import (
MetadataSource,
ScanType,
scan_firmware,
scan_platform,
scan_rom,
)
from handler.socket_handler import socket_handler
from logger.formatter import LIGHTYELLOW, RED
from logger.formatter import highlight as hl
Expand Down Expand Up @@ -138,7 +144,7 @@ async def scan_platforms(
platform_ids: list[int],
scan_type: ScanType = ScanType.QUICK,
roms_ids: list[str] | None = None,
metadata_sources: list[str] | None = None,
metadata_sources: list[MetadataSource] | None = None,
):
"""Scan all the listed platforms and fetch metadata from different sources
Expand All @@ -153,7 +159,7 @@ async def scan_platforms(
roms_ids = []

if not metadata_sources:
metadata_sources = ["igdb", "moby"]
metadata_sources = [MetadataSource.IGDB, MetadataSource.MOBY, MetadataSource.SS]

sm = _get_socket_manager()

Expand Down Expand Up @@ -225,7 +231,7 @@ async def _identify_platform(
scan_type: ScanType,
fs_platforms: list[str],
roms_ids: list[str],
metadata_sources: list[str],
metadata_sources: list[MetadataSource],
socket_manager: socketio.AsyncRedisManager,
) -> ScanStats:
# Stop the scan if the flag is set
Expand Down Expand Up @@ -418,7 +424,7 @@ async def _identify_rom(
rom: Rom | None,
scan_type: ScanType,
roms_ids: list[str],
metadata_sources: list[str],
metadata_sources: list[MetadataSource],
socket_manager: socketio.AsyncRedisManager,
) -> ScanStats:
scan_stats = ScanStats()
Expand Down

0 comments on commit d96239c

Please sign in to comment.