feat: enhance compatibility table with file name handling and UI updates
This commit is contained in:
@@ -17,6 +17,7 @@ from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from collections import Counter
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timezone
|
||||
@@ -77,8 +78,19 @@ def _vs_reference(reference: Snapshot, variant: Snapshot) -> dict[str, Any]:
|
||||
|
||||
|
||||
# --- table builder -----------------------------------------------------------------------------
|
||||
# Stored binaries are prefixed with the first 8 hex of their sha256 to keep filenames unique on
|
||||
# disk (e.g. ``333ab0c4_PIKLIB8.dll``). That prefix is per-file, so it must be stripped before
|
||||
# grouping — otherwise every copy of PIKLIB8.dll lands in its own row and nothing ever clusters.
|
||||
_HASH_PREFIX = re.compile(r"^[0-9a-fA-F]{8}_")
|
||||
|
||||
|
||||
def library_name(raw: str) -> str:
|
||||
"""The display/grouping name: the stored binary name with any ``<sha8>_`` prefix removed."""
|
||||
return _HASH_PREFIX.sub("", raw)
|
||||
|
||||
|
||||
def _library_name(snap: Snapshot) -> str:
|
||||
return snap.binary.get("name") or "?"
|
||||
return library_name(snap.binary.get("name") or "?")
|
||||
|
||||
|
||||
def _variant_id(index: int) -> str:
|
||||
@@ -115,6 +127,7 @@ def _build_library(name: str, entries: list[Entry]) -> dict[str, Any]:
|
||||
members = [
|
||||
{
|
||||
"game": e.game,
|
||||
"file": e.snapshot.binary.get("name"), # stored name, incl. the <sha8>_ prefix
|
||||
"engine": e.snapshot.binary.get("engine"),
|
||||
"compiler": e.snapshot.binary.get("compiler"),
|
||||
"sha256": e.snapshot.binary.get("sha256"),
|
||||
|
||||
Reference in New Issue
Block a user