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

Function _postprocess_scene_list

scenedetect/_cli/controller.py:81–102  ·  view source on GitHub ↗
(context: CliContext, scene_list: SceneList)

Source from the content-addressed store, hash-verified

79
80
81def _postprocess_scene_list(context: CliContext, scene_list: SceneList) -> SceneList:
82 # Handle --merge-last-scene. If set, when the last scene is shorter than --min-scene-len,
83 # it will be merged with the previous one.
84 if (
85 context.merge_last_scene
86 and context.min_scene_len is not None
87 and context.min_scene_len > 0
88 and len(scene_list) > 1
89 and (scene_list[-1][1] - scene_list[-1][0]) < context.min_scene_len
90 ):
91 new_last_scene = (scene_list[-2][0], scene_list[-1][1])
92 scene_list = [*scene_list[:-2], new_last_scene]
93
94 # Handle --drop-short-scenes.
95 if (
96 context.drop_short_scenes
97 and context.min_scene_len is not None
98 and context.min_scene_len > 0
99 ):
100 scene_list = [s for s in scene_list if (s[1] - s[0]) >= context.min_scene_len]
101
102 return scene_list
103
104
105def _detect(context: CliContext) -> tuple[SceneList, CutList] | None:

Callers 1

run_scenedetectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected