Merge branch 'master' of ssh://patema.crystalyx.net:2222/Xefir/dl
All checks were successful
dl / lint (push) Successful in 1m7s
dl / docker (push) Successful in 2m47s

This commit is contained in:
Michel Roux 2024-03-01 22:28:53 +01:00
commit 0e95a5b7a4
2 changed files with 11 additions and 9 deletions

View File

@ -17,10 +17,8 @@ root_url = "http://www.anime-ultime.net"
while nextHop: while nextHop:
r1 = requests.get(url) r1 = requests.get(url)
m1 = re.search( m1 = re.search(r"javascript:open_ddlbox\('dl_orig', '([0-9]+)', 'orig'\)", r1.text)
"javascript:open_ddlbox\('dl_orig', '([0-9]+)', 'orig'\)", r1.text # noqa: W605 m2 = re.search(r'submit.*:right;.*(info-0-1)/([0-9]+)/([^"]+)', r1.text)
)
m2 = re.search('submit.*:right;.*(info-0-1)/([0-9]+)/([^"]+)', r1.text)
if m1 is None: if m1 is None:
break break

View File

@ -16,9 +16,13 @@ if not path.is_dir():
exit(1) exit(1)
for console in path.iterdir(): 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
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 # download metadata
metadatas = get( metadatas = get(
@ -38,7 +42,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(): 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 +57,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