diff --git a/main.py b/main.py --- a/main.py +++ b/main.py @@ -2,8 +2,10 @@ import argparse import asyncio import json import queue +import shutil import threading from collections.abc import Callable +from pathlib import Path from typing import Any import env @@ -62,6 +64,23 @@ args = parser.parse_args() if args.flush_caches: flush_caches() + return + + def _test_binary(binary: str) -> bool: + if "/" in binary or "\\" in binary: + return Path(binary).exists() + return shutil.which(binary) is not None + + if not _test_binary(env.FFMPEG_PATH): + LOGGER.error( + "ffmpeg is required to crosspost media, but was not found!", env.FFMPEG_PATH + ) + return + if not _test_binary(env.FFPROBE_PATH): + LOGGER.error( + "ffprobe is required to crosspost media, but was not found!", + env.FFPROBE_PATH, + ) return if not env.DATA_DIR.exists():