From 82fbe43795b70b747cb21d1d1e08b6ea1fa962ce Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 27 Jul 2021 23:48:42 -0400 Subject: [PATCH] remove some roms that don't exist (included in other sets) --- Ample/Resources/roms.plist | 12 -------- python/mkroms.py | 57 ++++++++++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/Ample/Resources/roms.plist b/Ample/Resources/roms.plist index e57ae59..24430b7 100644 --- a/Ample/Resources/roms.plist +++ b/Ample/Resources/roms.plist @@ -2,12 +2,6 @@ - source - https://archive.org/download/mame0.224 - type - zip - version - 0.224 roms a1cass @@ -113,7 +107,6 @@ ivelultr kb_ec1841 kb_iskr1030 - kb_pc83 kb_pcxt83 keytronic_pc3270 las128e2 @@ -126,17 +119,12 @@ mac128k mac2fdhd mac512k - mac512ke macclas2 macclasc macii maciici - maciicx - maciihmu maciisi - maciivi maciivx - maciix mackbd_m0110 mackbd_m0110a mackbd_m0110a_f diff --git a/python/mkroms.py b/python/mkroms.py index 5b070ef..475f854 100644 --- a/python/mkroms.py +++ b/python/mkroms.py @@ -4,6 +4,9 @@ import subprocess from plist import to_plist import xml.etree.ElementTree as ET +from html.parser import HTMLParser +from os.path import splitext + from machines import MACHINES @@ -35,7 +38,7 @@ p.add_argument('--full', action='store_true') p.add_argument('machine', nargs="*") args = p.parse_args() -full = args.full +# full = args.full machines = args.machine if not machines: machines = [ *MACHINES, *EXTRA_MACHINES] @@ -82,8 +85,42 @@ EXCLUDE = [ ] +def build_known_roms_list(): + infile = "mame-0233-full.html" + # infile = "mame-0.231-merged.html" + rv = set() + + class X(HTMLParser): + rv = set() + + def handle_starttag(self, tag, attrs): + if tag != 'a': return + href = None + for xx in attrs: + if xx[0] == 'href': + href = xx[1] + break + if not href: return + root, ext = splitext(href) + if ext in (".7z", ".zip"): self.rv.add(root) + + + + x = X() + with open(infile) as f: + data = f.read() + x.feed(data) + x.close() + return x.rv + + + + mnames = set() rnames = set() + +known = build_known_roms_list() + for m in machines: print(m) @@ -101,9 +138,10 @@ for m in machines: # find machines that have a rom child for x in root.findall('machine/rom/..'): - mnames.add(x.get('name')) - for y in x.findall('./rom'): - rnames.add(y.get('name')) + name = x.get('name') + if (name in known): mnames.add(name) + # for y in x.findall('./rom'): + # rnames.add(y.get('name')) # print("\n\n\n") @@ -112,14 +150,15 @@ for m in machines: # for x in ll: # print(x) -if full: ROMS = list(mnames) -else: ROMS = list(mnames.difference(EXCLUDE)) +# if full: ROMS = list(mnames) +# else: ROMS = list(mnames.difference(EXCLUDE)) +ROMS = list(mnames) ROMS.sort() data = {} -data["source"] = "https://archive.org/download/mame0.224" -data["type"] = "zip" -data["version"] = "0.224" +# data["source"] = "https://archive.org/download/mame0.224" +# data["type"] = "zip" +# data["version"] = "0.224" data["roms"] = ROMS # print(ROMS)