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

Function _save_stats

scenedetect/_cli/controller.py:163–174  ·  view source on GitHub ↗

Handles saving the statsfile if -s/--stats was specified.

(context: CliContext)

Source from the content-addressed store, hash-verified

161
162
163def _save_stats(context: CliContext) -> None:
164 """Handles saving the statsfile if -s/--stats was specified."""
165 if not context.stats_file_path:
166 return
167 assert context.stats_manager is not None
168 if context.stats_manager.is_save_required():
169 path = get_and_create_path(context.stats_file_path, context.output)
170 logger.info("Saving frame metrics to stats file: %s", path)
171 with open(path, mode="w") as file:
172 context.stats_manager.save_to_csv(csv_file=file)
173 else:
174 logger.debug("No frame metrics updated, skipping update of the stats file.")
175
176
177def _load_scenes(context: CliContext) -> tuple[SceneList, CutList]:

Callers 1

run_scenedetectFunction · 0.85

Calls 3

get_and_create_pathFunction · 0.90
is_save_requiredMethod · 0.80
save_to_csvMethod · 0.80

Tested by

no test coverage detected