Builders¶
- class camtasia.builders.TimelineBuilder(project)[source]¶
Bases:
objectHigh-level builder for assembling Camtasia timelines.
Provides a cursor-based API for sequentially placing clips with automatic timing management.
- Usage:
builder = TimelineBuilder(project) builder.add_audio_sequence([‘intro.wav’, ‘main.wav’], pause=1.0) builder.add_background_image(‘bg.png’) builder.add_title(‘My Video’, duration=5.0)
- add_audio(file_path, *, track_name='Audio', duration=None)[source]¶
Import and place an audio file at the cursor position.
Advances the cursor by the clip duration.
- Return type:
- camtasia.builders.build_from_screenplay(project, screenplay, audio_dir, *, audio_track_name='Audio', default_pause=1.0, vo_file_resolver=None)[source]¶
Build a timeline from a parsed screenplay.
Places voiceover audio clips sequentially with pauses between them. Uses the TimelineBuilder cursor for automatic timing.
Note
Pauses are placed after all VO blocks in each section rather than interleaved with individual VO blocks. This is a design limitation of the current section-based iteration.
- Parameters:
project (
Project) – Target project.screenplay (
Screenplay) – Parsed Screenplay object.audio_dir (
str|Path) – Directory containing VO audio files.audio_track_name (
str) – Name for the audio track.default_pause (
float) – Default pause between VO blocks (seconds).vo_file_resolver (
Optional[Callable[[VOBlock],str|Path|None]]) – Optional callback to resolve VO block to audio file path. If None, looks for files matching the VO ID pattern.
- Return type:
- Returns:
Summary dict with counts.
- class camtasia.builders.TileLayout(project, track_prefix='Tile')[source]¶
Bases:
objectPlace images in a grid layout on the timeline.
- add_grid(image_paths, start_seconds, end_seconds, grid=(2, 2), stagger_seconds=0.0, scale=1.0, fade_in_seconds=0.5)[source]¶
Place images in a grid layout.
- Parameters:
image_paths (
list[Path|str]) – Images to place in the grid.start_seconds (
float) – When the first tile appears.end_seconds (
float) – When all tiles disappear.stagger_seconds (
float) – Delay between each tile appearing.scale (
float) – Scale factor for each tile.fade_in_seconds (
float) – Fade-in duration for each tile.
- Return type:
- class camtasia.builders.timeline_builder.TimelineBuilder(project)[source]¶
Bases:
objectHigh-level builder for assembling Camtasia timelines.
Provides a cursor-based API for sequentially placing clips with automatic timing management.
- Usage:
builder = TimelineBuilder(project) builder.add_audio_sequence([‘intro.wav’, ‘main.wav’], pause=1.0) builder.add_background_image(‘bg.png’) builder.add_title(‘My Video’, duration=5.0)
- add_audio(file_path, *, track_name='Audio', duration=None)[source]¶
Import and place an audio file at the cursor position.
Advances the cursor by the clip duration.
- Return type:
Build a timeline from a parsed screenplay.
- camtasia.builders.screenplay_builder.build_from_screenplay(project, screenplay, audio_dir, *, audio_track_name='Audio', default_pause=1.0, vo_file_resolver=None)[source]¶
Build a timeline from a parsed screenplay.
Places voiceover audio clips sequentially with pauses between them. Uses the TimelineBuilder cursor for automatic timing.
Note
Pauses are placed after all VO blocks in each section rather than interleaved with individual VO blocks. This is a design limitation of the current section-based iteration.
- Parameters:
project (
Project) – Target project.screenplay (
Screenplay) – Parsed Screenplay object.audio_dir (
str|Path) – Directory containing VO audio files.audio_track_name (
str) – Name for the audio track.default_pause (
float) – Default pause between VO blocks (seconds).vo_file_resolver (
Optional[Callable[[VOBlock],str|Path|None]]) – Optional callback to resolve VO block to audio file path. If None, looks for files matching the VO ID pattern.
- Return type:
- Returns:
Summary dict with counts.