🔊 Add logs and test if logo
This commit is contained in:
parent
7ced240788
commit
1ef87c84da
@ -26,9 +26,11 @@ 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():
|
||||||
# cleaning logos
|
# cleaning logos
|
||||||
for logo in Path(console / "logos").iterdir():
|
for logo in Path(console / "logos").iterdir():
|
||||||
|
print(f"Unlink {logo}")
|
||||||
logo.unlink()
|
logo.unlink()
|
||||||
# cleaning videos
|
# cleaning videos
|
||||||
for video in Path(console / "videos").iterdir():
|
for video in Path(console / "videos").iterdir():
|
||||||
|
print(f"Unlink {video}")
|
||||||
video.unlink()
|
video.unlink()
|
||||||
|
|
||||||
# run has_files
|
# run has_files
|
||||||
@ -50,20 +52,24 @@ for console in path.iterdir():
|
|||||||
|
|
||||||
# get rom ref
|
# get rom ref
|
||||||
for id in metadatas:
|
for id in metadatas:
|
||||||
if rom.name in metadatas[id]["name"]:
|
if rom.name in metadatas[id]["name"] and (
|
||||||
|
"ref" in metadatas[id] or "logo" in metadatas[id]
|
||||||
|
):
|
||||||
ref = metadatas[id]["ref"] if "ref" in metadatas[id] else id
|
ref = metadatas[id]["ref"] if "ref" in metadatas[id] else id
|
||||||
|
print(f"Found {ref} for {rom}")
|
||||||
|
|
||||||
|
# load json or create empty object
|
||||||
|
if paths["metadata"].is_file():
|
||||||
|
with open(paths["metadata"], "r") as file:
|
||||||
|
meta = load(file)
|
||||||
|
else:
|
||||||
|
meta = {}
|
||||||
|
|
||||||
|
# add rom to json
|
||||||
|
meta[hash] = {"ref": ref}
|
||||||
|
|
||||||
|
# write json
|
||||||
|
with open(paths["metadata"], "w") as file:
|
||||||
|
file.write(meta)
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
# load json or create empty object
|
|
||||||
if paths["metadata"].is_file():
|
|
||||||
with open(paths["metadata"], "r") as file:
|
|
||||||
meta = load(file)
|
|
||||||
else:
|
|
||||||
meta = {}
|
|
||||||
|
|
||||||
# add rom to json
|
|
||||||
meta[hash] = {"ref": ref}
|
|
||||||
|
|
||||||
# write json
|
|
||||||
with open(paths["metadata"], "w") as file:
|
|
||||||
file.write(meta)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user