⚡️ Use stem instead of name
This commit is contained in:
parent
948ef26397
commit
694c1722f4
@ -38,7 +38,7 @@ for console in path.iterdir():
|
|||||||
|
|
||||||
# loop over roms without hashes
|
# loop over roms without hashes
|
||||||
for rom in Path(path / "hashes" / console.name / "roms").iterdir():
|
for rom in Path(path / "hashes" / console.name / "roms").iterdir():
|
||||||
if rom.is_file() and "Disc" not in rom.name:
|
if rom.is_file() and "Disc" not in rom.stem:
|
||||||
# get rom hash
|
# get rom hash
|
||||||
with open(rom, "r") as file:
|
with open(rom, "r") as file:
|
||||||
hash = file.read()
|
hash = file.read()
|
||||||
@ -53,14 +53,14 @@ for console in path.iterdir():
|
|||||||
if "name" not in metadata:
|
if "name" not in metadata:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
rom_name = rom.name.split("(")[0].strip().lower()
|
rom_name = rom.stem.split('.')[0].split("(")[0].strip().lower()
|
||||||
meta_name = metadata["name"].split("(")[0].strip().lower()
|
meta_name = metadata["name"].split("(")[0].strip().lower()
|
||||||
|
|
||||||
if rom_name == meta_name and (
|
if rom_name == meta_name and (
|
||||||
"ref" in metadata or "logo" in metadata
|
"ref" in metadata or "logo" in metadata
|
||||||
):
|
):
|
||||||
ref = metadata["ref"] if "ref" in metadata else id
|
ref = metadata["ref"] if "ref" in metadata else id
|
||||||
print(f"Found {ref} for {rom.name}")
|
print(f"Found {ref} for {rom.stem}")
|
||||||
metas[hash] = {"ref": ref}
|
metas[hash] = {"ref": ref}
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user