diff --git a/tiddl/cli/app.py b/tiddl/cli/app.py index 96dd70f..603637d 100644 --- a/tiddl/cli/app.py +++ b/tiddl/cli/app.py @@ -6,6 +6,7 @@ from typing_extensions import Annotated from tiddl.cli.config import APP_PATH, CONFIG from tiddl.cli.ctx import ContextObject, Context from tiddl.cli.commands import register_commands +from tiddl.core.utils.ffmpeg import is_ffmpeg_installed as ifs log = logging.getLogger("tiddl") @@ -38,6 +39,9 @@ def callback( log.debug(f"{ctx.params=}") + is_ffmpeg_installed = ifs() + log.debug(f"{is_ffmpeg_installed=}") + if DEBUG: debug_path = APP_PATH / "api_debug" else: @@ -46,3 +50,9 @@ def callback( ctx.obj = ContextObject( api_omit_cache=OMIT_CACHE, console=Console(), debug_path=debug_path ) + + if not is_ffmpeg_installed: + ctx.obj.console.print( + "[yellow]WARNING ffmpeg is not installed, tiddl might not work properly, " + + "[link=https://github.com/oskvr37/tiddl/blob/main/README.md#installation]read README.md[/]" + ) diff --git a/tiddl/core/utils/ffmpeg.py b/tiddl/core/utils/ffmpeg.py index 4794326..2155c21 100644 --- a/tiddl/core/utils/ffmpeg.py +++ b/tiddl/core/utils/ffmpeg.py @@ -8,6 +8,8 @@ def run(cmd: list[str]): def is_ffmpeg_installed() -> bool: + """Checks if `ffmpeg` is installed.""" + try: run(["ffmpeg", "-version"]) return True