Project

Qualified name: algan.project.Project

class Project(scene_functions, video_settings=None, file_path=None, *, video_directory='videos', screenshot_directory='screenshots', transcript_directory='transcripts', transcript_line_length=88, speech_source=None)[source]

Bases: object

Coordinate a fixed collection of independently-authored Scene functions.

Scene IDs are their zero-based positions in scene_functions. Output stems are <id>_<name>. Frame IDs are derived from the scene ID and the save-frame call’s local index, so rendering any subset produces the same names as rendering the whole project.

Parameters:
  • scene_functions – A nonempty iterable of callables. Each callable must be invokable with no arguments. Optional parameters are allowed.

  • file_path – Destination for concatenate_videos(). It follows Scene.save_video path rules and defaults to the main script’s configured output filename.

  • video_directory – Output directories. A bare directory name is placed under Algan’s standard output directory; a path with an explicit parent is used as supplied.

  • screenshot_directory – Output directories. A bare directory name is placed under Algan’s standard output directory; a path with an explicit parent is used as supplied.

  • transcript_directory – Output directories. A bare directory name is placed under Algan’s standard output directory; a path with an explicit parent is used as supplied.

  • transcript_line_length (int) – Maximum number of characters per transcript line.

  • video_settings (VideoSettings | None) – Optional settings used to author and render every project Scene.

  • speech_source – Optional speech generator installed on each Scene’s audio manager.

Methods

concatenate_videos

Concatenate the project's scene videos into file_path.

frame_id

Return the stable project-global ID for one Scene save-frame call.

render_screenshots

Run save-frame calls for one, many, or all project scenes.

render_video

Render full videos for one, many, or all project scenes.

run_cli

Run the project action requested by command-line arguments.

concatenate_videos(*, threads=None, reencode=False)[source]

Concatenate the project’s scene videos into file_path.

Parameters:

threads (int | None)

frame_id(scene, local_frame_index)[source]

Return the stable project-global ID for one Scene save-frame call.

Parameters:

local_frame_index (int)

Return type:

int

render_screenshots(scenes=None, *, frames=None, stop_early=False, video_settings=None)[source]

Run save-frame calls for one, many, or all project scenes.

No scene videos are rendered. scenes accepts an ID, an unprefixed name, a full prefixed name, an iterable mixing those forms, or None for all scenes.

Parameters:
  • frames – Which save-frame calls to render, as a pattern or an iterable of them. A pattern is a frame index within its scene (3), a glob ("s05_*"), or a plain substring ("perturbed"); names match with or without the s<scene>_f<index>_ prefix, case-insensitively. Frames that match nothing are skipped without being rendered, which saves the render but not the authoring. Defaults to None, meaning every frame.

  • stop_early (bool) – Whether to abandon each scene as soon as every frames pattern has matched at least once, rather than authoring the rest of it. This is what makes iterating on an early frame of a long scene quick, but it leaves the scene half-run: its transcript is not synced and its later frames on disk stay as an earlier run left them. Requires frames. Defaults to False.

  • video_settings (VideoSettings | None)

render_video(scenes=None, *, video_settings=None, overwrite=True, **save_video_kwargs)[source]

Render full videos for one, many, or all project scenes.

Scene save-frame calls are skipped. scenes accepts an ID, an unprefixed name, a full prefixed name, an iterable mixing those forms, or None for all scenes.

Parameters:
run_cli(argv=None)[source]

Run the project action requested by command-line arguments.

argv defaults to the current process arguments (excluding the executable/script name). The recognized arguments are:

--render-screenshots [SCENE ...] [--frames PATTERN ...] [--stop-early]
--render-video [SCENE ...]
--concatenate-videos
--video-settings PRESET
--help

Scene values accept the same IDs and names as render_video() and render_screenshots(). Omitting them renders every scene. Unknown arguments are ignored so this can be called from scripts launched by tools that add their own command-line options – but -h/--help is now handled here, so a script that wants its own help must parse it before calling this.

Returns True after dispatching a recognized action and False when no project action was present.

Return type:

bool