MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / invoke_cli

Function invoke_cli

tests/helpers.py:21–36  ·  view source on GitHub ↗

Invoke the scenedetect CLI in-process using Click's CliRunner. Replicates the two-step execution of ``__main__.py``: 1. ``scenedetect.main(obj=context)`` - parse args and register callbacks on ``CliContext`` 2. ``run_scenedetect(context)`` - execute detection and output commands R

(args: list[str], catch_exceptions: bool = False)

Source from the content-addressed store, hash-verified

19
20
21def invoke_cli(args: list[str], catch_exceptions: bool = False) -> tuple[int, str]:
22 """Invoke the scenedetect CLI in-process using Click's CliRunner.
23
24 Replicates the two-step execution of ``__main__.py``:
25
26 1. ``scenedetect.main(obj=context)`` - parse args and register callbacks on ``CliContext``
27 2. ``run_scenedetect(context)`` - execute detection and output commands
28
29 Returns ``(exit_code, output_text)``.
30 """
31 context = CliContext()
32 runner = CliRunner()
33 result = runner.invoke(_scenedetect_cli, args, obj=context, catch_exceptions=catch_exceptions)
34 if result.exit_code == 0:
35 run_scenedetect(context)
36 return result.exit_code, result.output

Calls 2

CliContextClass · 0.90
run_scenedetectFunction · 0.90