refactor: read md5 lists through parse_hash_list

The RetroDECK and Recalbox exporters compare md5 lists with
resolve.reconcile.hash_values, and the RetroDECK scraper reads an entry's
md5 with md5_field and parse_hash_list instead of its own copy.

Recalbox's comparison no longer keeps an empty item: md5="a,,b" states
a,b where it stated ,a,b. The RetroDECK scraper now splits a
comma-joined value and refuses an md5 that is neither a string nor a
list of strings, as the batocera-systems readers do. The ten cached
component manifests write neither form, so retrodeck.yml is unchanged.
This commit is contained in:
Abdessamad Derraz committed 2026-11-20 20:02:44 +01:00
1 parent e19025231e
commit f7c08a6ca3
5 files changed
+50 -20

No files matched your search

+18
View File
@@ -82,5 +82,23 @@ class ManifestErrors(unittest.TestCase):
self.fetch(None)
class ManifestMd5(unittest.TestCase):
def test_a_string_or_a_list_gives_the_valid_values(self):
from scripts.scraper.retrodeck_scraper import _entry_md5
md5 = "0123456789abcdef0123456789ABCDEF"
self.assertEqual(_entry_md5(md5), md5.lower())
self.assertEqual(_entry_md5([md5, "", "not an md5", md5]), md5.lower())
self.assertEqual(_entry_md5(""), "")
self.assertEqual(_entry_md5(None), "")
def test_a_value_of_another_type_is_refused(self):
from scripts.scraper.retrodeck_scraper import _entry_md5
with self.assertRaises(ValueError):
_entry_md5([1])
if __name__ == "__main__":
unittest.main()