fix filesize reset on partial scan

This commit is contained in:
Georges-Antoine Assi
2025-10-28 08:56:45 -04:00
parent 11832d48c2
commit a2cfd571c5
2 changed files with 16 additions and 6 deletions

View File

@@ -340,6 +340,10 @@ async def _identify_rom(
for new_rom_file in new_rom_files:
db_rom_handler.add_rom_file(new_rom_file)
# Short circuit if the scan type is hashes
if scan_type == ScanType.HASHES:
return
if _added_rom.ra_metadata:
for ach in _added_rom.ra_metadata.get("achievements", []):
# Store both normal and locked version

View File

@@ -289,21 +289,27 @@ async def scan_rom(
newly_added: bool,
socket_manager: socketio.AsyncRedisManager | None = None,
) -> Rom:
filesize = sum([file.file_size_bytes for file in fs_rom["files"]])
rom_attrs = {
"platform_id": platform.id,
"name": fs_rom["fs_name"],
"fs_name": fs_rom["fs_name"],
"crc_hash": fs_rom["crc_hash"],
"md5_hash": fs_rom["md5_hash"],
"sha1_hash": fs_rom["sha1_hash"],
"ra_hash": fs_rom["ra_hash"],
"fs_size_bytes": filesize,
"url_cover": "",
"url_manual": "",
"url_screenshots": [],
}
if len(fs_rom["files"]) > 0:
filesize = sum([file.file_size_bytes for file in fs_rom["files"]])
rom_attrs.update(
{
"crc_hash": fs_rom["crc_hash"],
"md5_hash": fs_rom["md5_hash"],
"sha1_hash": fs_rom["sha1_hash"],
"ra_hash": fs_rom["ra_hash"],
"fs_size_bytes": filesize,
}
)
if rom:
rom_attrs.update(
{