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

Function main

scenedetect/__main__.py:23–56  ·  view source on GitHub ↗

PySceneDetect command-line interface (CLI) entry point.

()

Source from the content-addressed store, hash-verified

21
22
23def main():
24 """PySceneDetect command-line interface (CLI) entry point."""
25 context = CliContext()
26 try:
27 # Process command line arguments and subcommands to initialize the context.
28 scenedetect.main(obj=context) # Parse CLI arguments with registered callbacks.
29 except SystemExit as exit:
30 help_command = any(arg in sys.argv for arg in ["-h", "--help"])
31 if help_command or exit.code != 0:
32 raise
33
34 # If we get here, processing the command line and loading the context worked. Let's run
35 # the controller if we didn't process any help requests.
36 logger = getLogger("pyscenedetect")
37 # Ensure log messages don't conflict with any progress bars. If we're in quiet mode, where
38 # no progress bars get created, we instead create a fake context manager. This is done here
39 # to avoid needing a separate context manager at each point a progress bar is created.
40 log_redirect = (
41 FakeTqdmLoggingRedirect() if context.quiet_mode else logging_redirect_tqdm(loggers=[logger])
42 )
43
44 with log_redirect:
45 try:
46 run_scenedetect(context)
47 except KeyboardInterrupt:
48 logger.info("Stopped.")
49 if DEBUG_MODE:
50 raise
51 raise SystemExit(1) from None
52 except BaseException as ex:
53 if DEBUG_MODE:
54 raise
55 logger.critical("ERROR: Unhandled exception:", exc_info=ex)
56 raise SystemExit(1) from ex
57
58
59if __name__ == "__main__":

Callers 1

__main__.pyFile · 0.70

Calls 3

CliContextClass · 0.90
run_scenedetectFunction · 0.90

Tested by

no test coverage detected