From 910428c6f1dbfa1a2fe44ac99d528d479833c69f Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:52:20 +0100 Subject: [PATCH] fix: resolve large files from cache in database paths --- database.json | 10 +++++----- scripts/generate_db.py | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/database.json b/database.json index 77b8497e..4fd621aa 100644 --- a/database.json +++ b/database.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-03-25T11:16:01Z", + "generated_at": "2026-03-25T11:51:38Z", "total_files": 6733, "total_size": 5288644732, "files": { @@ -67294,7 +67294,7 @@ "adler32": "dbd42440" }, "b48f44194fe918aaaec5298861479512b581d661": { - "path": "bios/Nintendo/Nintendo DS/dsi_nand.bin", + "path": ".cache/large/dsi_nand.bin", "name": "dsi_nand.bin", "size": 251658304, "sha1": "b48f44194fe918aaaec5298861479512b581d661", @@ -67304,7 +67304,7 @@ "adler32": "3b3e7d56" }, "093f8698b54b78dcb701de2043f82639de51d63b": { - "path": "bios/Sony/PlayStation 3/PS3UPDAT.PUP", + "path": ".cache/large/PS3UPDAT.PUP", "name": "PS3UPDAT.PUP", "size": 206126236, "sha1": "093f8698b54b78dcb701de2043f82639de51d63b", @@ -67314,7 +67314,7 @@ "adler32": "1ec0b1c3" }, "ed3a4cb264fff283209f10ae58c96c6090fed187": { - "path": "bios/Sony/PlayStation Vita/PSP2UPDAT.PUP", + "path": ".cache/large/PSP2UPDAT.PUP", "name": "PSP2UPDAT.PUP", "size": 56778752, "sha1": "ed3a4cb264fff283209f10ae58c96c6090fed187", @@ -67324,7 +67324,7 @@ "adler32": "620a2ff1" }, "cc72dfcc964577cc29112ef368c28f55277c237c": { - "path": "bios/Sony/PlayStation Vita/PSVUPDAT.PUP", + "path": ".cache/large/PSVUPDAT.PUP", "name": "PSVUPDAT.PUP", "size": 133834240, "sha1": "cc72dfcc964577cc29112ef368c28f55277c237c", diff --git a/scripts/generate_db.py b/scripts/generate_db.py index 5098b887..d853f320 100644 --- a/scripts/generate_db.py +++ b/scripts/generate_db.py @@ -236,6 +236,9 @@ def _preserve_large_file_entries(files: dict, db_path: str) -> int: in .gitignore. When generate_db runs locally without them, their entries would be lost. This reads the existing database and re-adds entries whose paths match .gitignore bios/ entries. + + If the file exists in .cache/large/, the path is updated so that + resolve_local_file can find it for verify and pack generation. """ gitignored = _load_gitignored_bios_paths() if not gitignored: @@ -247,10 +250,16 @@ def _preserve_large_file_entries(files: dict, db_path: str) -> int: except (FileNotFoundError, json.JSONDecodeError): return 0 + cache_dir = Path(".cache/large") count = 0 for sha1, entry in existing_db.get("files", {}).items(): path = entry.get("path", "") if path in gitignored and sha1 not in files: + # Point to cached copy if available + name = entry.get("name", "") + cached = cache_dir / name + if cached.exists(): + entry = {**entry, "path": str(cached)} files[sha1] = entry count += 1 return count