Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add override ffmpeg flag #72

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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
71 changes: 46 additions & 25 deletions jellybench_py/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,14 @@ def parse_args():
action="store_true",
help=argparse.SUPPRESS,
)

parser.add_argument(
"--override-ffmpeg",
dest="ffmpeg_override",
type=str,
help="Override server provided ffmpeg with ffmpeg binary at this path",
)

return parser.parse_args()


Expand Down Expand Up @@ -695,33 +703,46 @@ def cli() -> None:
print()

# Download ffmpeg
ffmpeg_data = server_data["ffmpeg"]
print(styled("Loading ffmpeg", [Style.BOLD]))
print('| Searching local "ffmpeg"...', end="")
ffmpeg_download = obtainSource(
args.ffmpeg_path,
ffmpeg_data["ffmpeg_source_url"],
ffmpeg_data["ffmpeg_hashs"],
"ffmpeg",
quiet=False,
)
if not (args.debug_flag and args.ffmpeg_override):
ffmpeg_data = server_data["ffmpeg"]
print(styled("Loading ffmpeg", [Style.BOLD]))
print('| Searching local "ffmpeg" -', end="")
ffmpeg_download = obtainSource(
args.ffmpeg_path,
ffmpeg_data["ffmpeg_source_url"],
ffmpeg_data["ffmpeg_hashs"],
"ffmpeg",
quiet=False,
)

if ffmpeg_download[0] is False:
print(f"An Error occured: {ffmpeg_download[1]}")
input("Press any key to exit")
exit()
elif ffmpeg_download[1].endswith((".zip", ".tar.gz", ".tar.xz")):
ffmpeg_files = f"{args.ffmpeg_path}/ffmpeg_files"
unpackArchive(ffmpeg_download[1], ffmpeg_files)
ffmpeg_binary = f"{ffmpeg_files}/ffmpeg"
if system_info["os"]["id"] == "windows":
ffmpeg_binary = f"{ffmpeg_binary}.exe"
else:
ffmpeg_binary = ffmpeg_download[1]
ffmpeg_binary = os.path.abspath(ffmpeg_binary)
ffmpeg_binary = ffmpeg_binary.replace("\\", "\\\\")
print(styled("Done", [Style.GREEN]))
print()

if ffmpeg_download[0] is False:
print(f"An Error occured: {ffmpeg_download[1]}")
input("Press any key to exit")
exit()
elif ffmpeg_download[1].endswith((".zip", ".tar.gz", ".tar.xz")):
ffmpeg_files = f"{args.ffmpeg_path}/ffmpeg_files"
unpackArchive(ffmpeg_download[1], ffmpeg_files)
ffmpeg_binary = f"{ffmpeg_files}/ffmpeg"
if system_info["os"]["id"] == "windows":
ffmpeg_binary = f"{ffmpeg_binary}.exe"
else:
ffmpeg_binary = ffmpeg_download[1]
ffmpeg_binary = os.path.abspath(ffmpeg_binary)
ffmpeg_binary = ffmpeg_binary.replace("\\", "\\\\")
print(styled("Done", [Style.GREEN]))
print()
ffmpeg_binary = os.path.abspath(args.ffmpeg_override)
print_debug(f"> Overriding server ffmpeg with {ffmpeg_binary}")
if not os.path.exists(ffmpeg_binary):
print_debug(
"ERROR: Provided ffmpeg path does not exist or is not accessible by the current user."
)
exit()
elif os.path.isdir(ffmpeg_binary):
print_debug("ERROR: Provided ffmpeg path is a directory")
exit()

# Downloading Videos
files = server_data["tests"]
Expand Down