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 5b29289..31dd043 100644 --- a/commands/retro.py +++ b/commands/retro.py @@ -16,9 +16,13 @@ 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]) + run(["has_files.sh", f"{console.name}/roms", console.name, "false", path]) # download metadata metadatas = get( @@ -38,7 +42,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.stem: # get rom hash with open(rom, "r") as file: hash = file.read() @@ -53,14 +57,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