From 948ef263975955a4d54e01fe0e682e4d689972e7 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 23 Feb 2024 14:42:30 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Ignore=20Disc=20on=20r?= =?UTF-8?q?etropy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/retro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/retro.py b/commands/retro.py index 5b29289..f114d9b 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(): + if rom.is_file() and "Disc" not in rom.name: # get rom hash with open(rom, "r") as file: hash = file.read() From 694c1722f48a4ff182bd831b819ba9e4e71dc761 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 23 Feb 2024 15:04:46 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Use=20stem=20instead?= =?UTF-8?q?=20of=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 From bb376df09f74c0e55a4458ec8cda510c11fd4c9b Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 23 Feb 2024 15:10:48 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=92=9A=20Fix=20flake8=20on=20anime-ul?= =?UTF-8?q?time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/anime-ultime.py | 6 ++---- commands/retro.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/commands/anime-ultime.py b/commands/anime-ultime.py index 1612d8e..38dfbdc 100755 --- a/commands/anime-ultime.py +++ b/commands/anime-ultime.py @@ -17,10 +17,8 @@ root_url = "http://www.anime-ultime.net" while nextHop: r1 = requests.get(url) - m1 = re.search( - "javascript:open_ddlbox\('dl_orig', '([0-9]+)', 'orig'\)", r1.text # noqa: W605 - ) - m2 = re.search('submit.*:right;.*(info-0-1)/([0-9]+)/([^"]+)', r1.text) + m1 = re.search(r"javascript:open_ddlbox\('dl_orig', '([0-9]+)', 'orig'\)", r1.text) + m2 = re.search(r'submit.*:right;.*(info-0-1)/([0-9]+)/([^"]+)', r1.text) if m1 is None: break diff --git a/commands/retro.py b/commands/retro.py index c8ac00a..8f54c61 100644 --- a/commands/retro.py +++ b/commands/retro.py @@ -53,7 +53,7 @@ for console in path.iterdir(): if "name" not in metadata: continue - rom_name = rom.stem.split('.')[0].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 ( From 480276c3160d2aae4e83ad475634a1d1d92e3dba Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 24 Feb 2024 22:40:05 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Test=20if=20iter=20aro?= =?UTF-8?q?und=20roms=20dir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/retro.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/retro.py b/commands/retro.py index 8f54c61..ec457ef 100644 --- a/commands/retro.py +++ b/commands/retro.py @@ -16,7 +16,11 @@ if not path.is_dir(): exit(1) for console in path.iterdir(): - if console.is_dir() and Path(console / "roms").is_dir(): + if ( + console.is_dir() + and Path(console / "roms").is_dir() + and list(Path(console / "roms").iterdir()) + ): # run has_files run(["has_files.sh", f"{console.name}/roms", console.name, "true", path]) From fcce48de5a43ddfbf5c75614fb571550c2ebc902 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 24 Feb 2024 23:01:37 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Don't=20delete=20old?= =?UTF-8?q?=20hashes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/retro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/retro.py b/commands/retro.py index ec457ef..31dd043 100644 --- a/commands/retro.py +++ b/commands/retro.py @@ -22,7 +22,7 @@ for console in path.iterdir(): and list(Path(console / "roms").iterdir()) ): # run has_files - run(["has_files.sh", f"{console.name}/roms", console.name, "true", path]) + run(["has_files.sh", f"{console.name}/roms", console.name, "false", path]) # download metadata metadatas = get(