mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-26 05:37:20 -05:00
feat: read batocera md5 written as a list
batocera.linux 6b08b873 lets a biosFiles item declare its md5 as a list of strings, and checkBios accepts a file matching any of them. The scrapers join the values with commas, as for Recalbox, and record md5_list so the export writes the list back as a list, byte for byte.
This commit is contained in:
1 parent
e86defdb1e
commit
0b4504992b
9 files changed
+298
-13
No files matched your search
@@ -74,6 +74,25 @@ class ChangeSet:
|
||||
MAX_RESPONSE_SIZE = 50 * 1024 * 1024 # 50 MB
|
||||
|
||||
|
||||
def md5_field(raw: object) -> tuple[list[str], bool]:
|
||||
"""The md5 values a batocera-systems item declares, and whether it
|
||||
writes them as a list.
|
||||
|
||||
Since batocera.linux 6b08b873 an item's md5 is one string or a list of
|
||||
strings, and checkBios accepts a file whose md5 is any of them. The
|
||||
platform YAML joins the values with commas, as it does for Recalbox, and
|
||||
records the list form so the export writes a list back as a list: a
|
||||
one-item list and an empty one are not the same text as a string.
|
||||
"""
|
||||
if raw is None:
|
||||
return [], False
|
||||
if isinstance(raw, str):
|
||||
return ([raw] if raw else []), False
|
||||
if isinstance(raw, list) and all(isinstance(item, str) for item in raw):
|
||||
return [item for item in raw if item], True
|
||||
raise ValueError(f"md5 is neither a string nor a list of strings: {raw!r}")
|
||||
|
||||
|
||||
def requirement_entry(req: BiosRequirement) -> dict:
|
||||
"""Serialize a requirement to a platform YAML file entry.
|
||||
|
||||
|
||||
Reference in new issue
Block a user