MCPcopy Index your code
hub / github.com/Breakthrough/PySceneDetect / invoke_scenedetect

Function invoke_scenedetect

tests/test_cli.py:68–105  ·  view source on GitHub ↗

Invokes the scenedetect CLI with the specified arguments and returns the exit code. The kwargs are passed to the args format method, for example: invoke_scenedetect('-i {VIDEO} {DETECTOR}', VIDEO='file.mp4', DETECTOR='detect-content') Providing `output_dir` and `config_file` set -o

(
    args: str = "",
    output_dir: StrPath | None = None,
    config_file: str | None = DEFAULT_CONFIG_FILE,
    **kwargs,
)

Source from the content-addressed store, hash-verified

66
67
68def invoke_scenedetect(
69 args: str = "",
70 output_dir: StrPath | None = None,
71 config_file: str | None = DEFAULT_CONFIG_FILE,
72 **kwargs,
73):
74 """Invokes the scenedetect CLI with the specified arguments and returns the exit code.
75 The kwargs are passed to the args format method, for example:
76
77 invoke_scenedetect('-i {VIDEO} {DETECTOR}', VIDEO='file.mp4', DETECTOR='detect-content')
78
79 Providing `output_dir` and `config_file` set -o/--output and -c/--config, respectively.
80
81 Default values are set for any arguments found in the command:
82 VIDEO -> VIDEO_PATH
83 VIDEO_NAME -> VIDEO_NAME
84 DETECTOR -> DEFAULT_DETECTOR
85 TIME -> DEFAULT_TIME
86 STATS -> DEFAULT_STATSFILE
87 BACKEND -> DEFAULT_BACKEND
88 CONFIG_FILE -> DEFAULT_CONFIG_FILE
89 """
90 value_dict = dict(
91 VIDEO=DEFAULT_VIDEO_PATH,
92 VIDEO_NAME=DEFAULT_VIDEO_NAME,
93 TIME=DEFAULT_TIME,
94 DETECTOR=DEFAULT_DETECTOR,
95 STATS=DEFAULT_STATSFILE,
96 BACKEND=DEFAULT_BACKEND,
97 )
98 value_dict.update(**kwargs)
99 command = SCENEDETECT_CMD
100 if output_dir:
101 command += f" -o {output_dir}"
102 if config_file:
103 command += f" -c {config_file}"
104 command += " " + args.format(**value_dict)
105 return subprocess.call(command.strip().split(" "))
106
107
108def test_cli_no_args():

Calls 2

updateMethod · 0.80
formatMethod · 0.80

Tested by

no test coverage detected