From 694c1722f48a4ff182bd831b819ba9e4e71dc761 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 23 Feb 2024 15:04:46 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Use=20stem=20instead=20of?= =?UTF-8?q?=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/retro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/retro.py b/commands/retro.py index f114d9b..c8ac00a 100644 --- a/commands/retro.py +++ b/commands/retro.py @@ -38,7 +38,7 @@ for console in path.iterdir(): # loop over roms without hashes 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 with open(rom, "r") as file: hash = file.read() @@ -53,14 +53,14 @@ for console in path.iterdir(): if "name" not in metadata: 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() if rom_name == meta_name and ( "ref" in metadata or "logo" in metadata ): 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} break