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

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:
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

View File

@ -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