Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion verifydump/convert.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import functools
import logging
import os
import pathlib
import re
import shutil
import subprocess
import tempfile

Expand Down Expand Up @@ -176,10 +178,24 @@ def convert_gdi_to_cue(gdi_file_path: pathlib.Path, cue_file_path: pathlib.Path)
cue_file.write(" INDEX 01 00:02:00\n")


@functools.cache
def find_binary(*names):
for name in names:
fullpath = shutil.which(name)
if fullpath:
return fullpath


def get_sha1hex_for_rvz(rvz_path, show_command_output: bool) -> str:
with tempfile.TemporaryDirectory() as dolphin_tool_user_folder_name:
dolphintool_result = subprocess.run(
["DolphinTool", "verify", "-u", dolphin_tool_user_folder_name, "-i", str(rvz_path), "--algorithm=sha1"],
[
find_binary("DolphinTool", "dolphin-tool"),
"verify",
"-u", dolphin_tool_user_folder_name,
"-i", str(rvz_path),
"--algorithm=sha1",
],
capture_output=True,
text=True,
)
Expand Down