mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 23:06:11 +00:00
Merge pull request #1081 from rommapp/hotfix-hash-calc-scans
Hotfix scans when running HASH_SCAN
This commit is contained in:
@@ -28,10 +28,14 @@ def upgrade() -> None:
|
||||
sa.Column("sha1_hash", sa.String(length=100), nullable=True)
|
||||
)
|
||||
|
||||
# Run a no-scan in the background on startup
|
||||
# Run a no-scan in the background on migrate
|
||||
if not IS_PYTEST_RUN:
|
||||
high_prio_queue.enqueue(
|
||||
scan_platforms, [], ScanType.HASH_SCAN, [], [], job_timeout=SCAN_TIMEOUT
|
||||
scan_platforms, [], ScanType.QUICK, [], [], job_timeout=SCAN_TIMEOUT
|
||||
)
|
||||
|
||||
high_prio_queue.enqueue(
|
||||
scan_platforms, [], ScanType.HASHES, [], [], job_timeout=SCAN_TIMEOUT
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ def _should_scan_rom(scan_type: ScanType, rom: Rom, roms_ids: list):
|
||||
return (
|
||||
(scan_type in {ScanType.NEW_PLATFORMS, ScanType.QUICK} and not rom)
|
||||
or (scan_type == ScanType.COMPLETE)
|
||||
or (scan_type == ScanType.HASH_SCAN)
|
||||
or (scan_type == ScanType.HASHES)
|
||||
or (
|
||||
rom
|
||||
and (
|
||||
@@ -341,6 +341,10 @@ async def _identify_rom(
|
||||
|
||||
_added_rom = db_rom_handler.add_rom(scanned_rom)
|
||||
|
||||
# Return early if we're only scanning for hashes
|
||||
if scan_type == ScanType.HASHES:
|
||||
return scan_stats
|
||||
|
||||
path_cover_s, path_cover_l = await fs_resource_handler.get_cover(
|
||||
overwrite=True,
|
||||
entity=_added_rom,
|
||||
|
||||
@@ -24,7 +24,7 @@ class ScanType(Enum):
|
||||
UNIDENTIFIED = "unidentified"
|
||||
PARTIAL = "partial"
|
||||
COMPLETE = "complete"
|
||||
HASH_SCAN = "hash_scan"
|
||||
HASHES = "hashes"
|
||||
|
||||
|
||||
async def _get_main_platform_igdb_id(platform: Platform):
|
||||
@@ -231,12 +231,12 @@ async def scan_rom(
|
||||
)
|
||||
|
||||
# Calculating hashes is expensive, so we only do it if necessary
|
||||
if not rom or scan_type == ScanType.COMPLETE or scan_type == ScanType.HASH_SCAN:
|
||||
if not rom or scan_type == ScanType.COMPLETE or scan_type == ScanType.HASHES:
|
||||
rom_hashes = fs_rom_handler.get_rom_hashes(rom_attrs["file_name"], roms_path)
|
||||
rom_attrs.update(**rom_hashes)
|
||||
|
||||
# If no metadata scan is required
|
||||
if scan_type == ScanType.HASH_SCAN:
|
||||
if scan_type == ScanType.HASHES:
|
||||
return Rom(**rom_attrs)
|
||||
|
||||
async def fetch_igdb_rom():
|
||||
|
||||
Reference in New Issue
Block a user