mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 12:22:33 -05:00
fix: recalbox paths from scrape, batocera md5 fallback from scrape
This commit is contained in:
@@ -47,7 +47,18 @@ class Exporter(BaseExporter):
|
|||||||
scraped_sys = scraped_data.get("systems", {}).get(sys_id) if scraped_data else None
|
scraped_sys = scraped_data.get("systems", {}).get(sys_id) if scraped_data else None
|
||||||
display_name = self._display_name(sys_id, scraped_sys)
|
display_name = self._display_name(sys_id, scraped_sys)
|
||||||
|
|
||||||
|
# Build md5 lookup from scraped data for this system
|
||||||
|
scraped_md5: dict[str, str] = {}
|
||||||
|
if scraped_data:
|
||||||
|
s_sys = scraped_data.get("systems", {}).get(sys_id, {})
|
||||||
|
for sf in s_sys.get("files", []):
|
||||||
|
sname = sf.get("name", "").lower()
|
||||||
|
smd5 = sf.get("md5", "")
|
||||||
|
if sname and smd5:
|
||||||
|
scraped_md5[sname] = smd5
|
||||||
|
|
||||||
# Build biosFiles entries as compact single-line dicts
|
# Build biosFiles entries as compact single-line dicts
|
||||||
|
# Original format ALWAYS has md5 — use scraped md5 as fallback
|
||||||
bios_parts: list[str] = []
|
bios_parts: list[str] = []
|
||||||
for fe in files:
|
for fe in files:
|
||||||
name = fe.get("name", "")
|
name = fe.get("name", "")
|
||||||
@@ -57,6 +68,8 @@ class Exporter(BaseExporter):
|
|||||||
md5 = fe.get("md5", "")
|
md5 = fe.get("md5", "")
|
||||||
if isinstance(md5, list):
|
if isinstance(md5, list):
|
||||||
md5 = md5[0] if md5 else ""
|
md5 = md5[0] if md5 else ""
|
||||||
|
if not md5:
|
||||||
|
md5 = scraped_md5.get(name.lower(), "")
|
||||||
|
|
||||||
entry_parts = []
|
entry_parts = []
|
||||||
if md5:
|
if md5:
|
||||||
|
|||||||
@@ -56,14 +56,26 @@ class Exporter(BaseExporter):
|
|||||||
|
|
||||||
lines.append(f' <system fullname="{display_name}" platform="{native_id}">')
|
lines.append(f' <system fullname="{display_name}" platform="{native_id}">')
|
||||||
|
|
||||||
|
# Build path lookup from scraped data for this system
|
||||||
|
scraped_paths: dict[str, str] = {}
|
||||||
|
if scraped_data:
|
||||||
|
s_sys = scraped_data.get("systems", {}).get(sys_id, {})
|
||||||
|
for sf in s_sys.get("files", []):
|
||||||
|
sname = sf.get("name", "").lower()
|
||||||
|
spath = sf.get("destination", sf.get("name", ""))
|
||||||
|
if sname and spath:
|
||||||
|
scraped_paths[sname] = spath
|
||||||
|
|
||||||
for fe in files:
|
for fe in files:
|
||||||
name = fe.get("name", "")
|
name = fe.get("name", "")
|
||||||
if name.startswith("_") or self._is_pattern(name):
|
if name.startswith("_") or self._is_pattern(name):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
dest = self._dest(fe)
|
# Use scraped path when available (preserves original format)
|
||||||
# Recalbox paths include system prefix
|
path = scraped_paths.get(name.lower())
|
||||||
path = f"{native_id}/{dest}" if "/" not in dest else dest
|
if not path:
|
||||||
|
dest = self._dest(fe)
|
||||||
|
path = f"{native_id}/{dest}" if "/" not in dest else dest
|
||||||
|
|
||||||
md5 = fe.get("md5", "")
|
md5 = fe.get("md5", "")
|
||||||
if isinstance(md5, list):
|
if isinstance(md5, list):
|
||||||
@@ -103,9 +115,8 @@ class Exporter(BaseExporter):
|
|||||||
for bios_el in root.iter("bios"):
|
for bios_el in root.iter("bios"):
|
||||||
path = bios_el.get("path", "")
|
path = bios_el.get("path", "")
|
||||||
if path:
|
if path:
|
||||||
exported_paths.add(path)
|
exported_paths.add(path.lower())
|
||||||
# Also index basename
|
exported_paths.add(path.split("/")[-1].lower())
|
||||||
exported_paths.add(path.split("/")[-1])
|
|
||||||
|
|
||||||
issues: list[str] = []
|
issues: list[str] = []
|
||||||
for sys_data in truth_data.get("systems", {}).values():
|
for sys_data in truth_data.get("systems", {}).values():
|
||||||
@@ -114,6 +125,6 @@ class Exporter(BaseExporter):
|
|||||||
if name.startswith("_") or self._is_pattern(name):
|
if name.startswith("_") or self._is_pattern(name):
|
||||||
continue
|
continue
|
||||||
dest = self._dest(fe)
|
dest = self._dest(fe)
|
||||||
if name not in exported_paths and dest not in exported_paths:
|
if name.lower() not in exported_paths and dest.lower() not in exported_paths:
|
||||||
issues.append(f"missing: {name}")
|
issues.append(f"missing: {name}")
|
||||||
return issues
|
return issues
|
||||||
|
|||||||
Reference in New Issue
Block a user