braidio 0.0.89__tar.gz → 0.0.91__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {braidio-0.0.89 → braidio-0.0.91}/PKG-INFO +1 -1
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/__init__.py +53 -1
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_episode.py +51 -13
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_video_cut.py +86 -12
- {braidio-0.0.89 → braidio-0.0.91}/pyproject.toml +1 -1
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_nw_app.py +21 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_transforms.py +153 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_video_transforms.py +50 -0
- {braidio-0.0.89 → braidio-0.0.91}/.editorconfig +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/.gitattributes +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/.gitignore +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/LICENSE +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/README.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/__init__.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/_paths.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/bodies/__init__.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/bodies/_domain.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/bodies/_render_nodes.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/bodies/_tiers.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/bodies/_video.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/captions.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/compose.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/conversation.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/cost.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/data/skills/braidio/SKILL.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/data/skills/braidio-commentary-video/SKILL.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/defaults.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/delivery.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/downloads.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/formats.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/genre.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/importing/__init__.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/importing/__main__.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/importing/_catalog.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/importing/_manifest.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/importing/_writer.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/kinds.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/leveling.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/markdown_script.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/__init__.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/_docs.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/_guide.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/_helpers.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/_media.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/credentials.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/metering.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/tools.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/mcp/workspace.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/multivoice.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/music.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/pacing.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/project.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/provenance.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/relevance.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/render.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/rights.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/script.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/sources.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/structure.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/style.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/textprep.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/timeline.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_asset_refs.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_common.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_dialogue.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_ingest.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_narration.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_segment.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_video_panels.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/transforms/_voice.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/tts.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/video.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/voice_library.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/weave.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/braidio/weave_config.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/conftest.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/Extraction and nw-App Design.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/research/commentary-formats-and-styles.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/research/conversational-vs-narration-tts.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/research/notebooklm-and-conversational-pacing.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/README.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/anti-platitude-checklist.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/commentary-voice-guide.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/_style-groups.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/amanda-dobbins.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/david-sims.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/griffin-newman.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/helen-molesworth.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/hrishikesh-hirway.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/jason-mantzoukas.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/john-mcwhorter.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/jon-caramanica.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/june-diane-raphael.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/karina-longworth.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/katy-hessel.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/louis-theroux.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/mallory-rubin.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/melvyn-bragg.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/michael-barbaro.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/nate-sloan-charlie-harding.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/paul-scheer.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/sean-fennessey.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/talk-art.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/style/voices/yasi-salek.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/misc/docs/youtube_ingest_credentials.md +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/_audio.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_body_schema_stability.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_conversation.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_cost.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_credits_card.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_defaults.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_delivery.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_downloads.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_expressiveness.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_formats.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_genre_placement.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_graph_speak.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_importing.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_leveling.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_markdown_script.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_mcp.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_mcp_caller_key.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_media_auth.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_multivoice.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_music.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_namespaced_source.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_pacing.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_packaging.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_render_settings.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_script.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_sources.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_speak_seam.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_structure.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_textprep_style.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_timeline.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_transforms_dialogue.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_transforms_episode_members.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_transforms_rights.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_transforms_secrets.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_transforms_structure.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_tts_api_key.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_turn_overlap.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_video.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_video_bodies.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_video_footage.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_voice_library.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_weave.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_weave_config.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_weave_master.py +0 -0
- {braidio-0.0.89 → braidio-0.0.91}/tests/test_wire_descriptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: braidio
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.91
|
|
4
4
|
Summary: Weave narration with extracted media segments into audiovisual productions
|
|
5
5
|
Project-URL: Homepage, https://github.com/thorwhalen/braidio
|
|
6
6
|
Project-URL: Repository, https://github.com/thorwhalen/braidio
|
|
@@ -37,7 +37,29 @@ from __future__ import annotations
|
|
|
37
37
|
|
|
38
38
|
from nw import TransformInputs
|
|
39
39
|
|
|
40
|
-
from braidio.transforms._common import
|
|
40
|
+
from braidio.transforms._common import (
|
|
41
|
+
ELEVENLABS_SECRET,
|
|
42
|
+
TIER_WEAVE_CONFIG,
|
|
43
|
+
TIER_PRODUCTION_STRUCTURE,
|
|
44
|
+
TIER_RENDER_PROFILE,
|
|
45
|
+
TIER_DIALOGUE_CAST,
|
|
46
|
+
TIER_SOURCE_MEDIA,
|
|
47
|
+
TIER_NARRATIVE_BEAT,
|
|
48
|
+
TIER_DIALOGUE_BEAT,
|
|
49
|
+
TIER_SCENE_BREAK,
|
|
50
|
+
TIER_AUDIO_CLIP,
|
|
51
|
+
TIER_VOICE_ASSIGNMENT,
|
|
52
|
+
TIER_NARRATION_RENDER,
|
|
53
|
+
TIER_DIALOGUE_RENDER,
|
|
54
|
+
TIER_SEGMENT_EXTRACTION,
|
|
55
|
+
TIER_EPISODE_RENDER,
|
|
56
|
+
TIER_STILL,
|
|
57
|
+
TIER_VIDEO_PANEL,
|
|
58
|
+
TIER_VIDEO_CUT,
|
|
59
|
+
TIER_LABEL_TRACK,
|
|
60
|
+
graph_index,
|
|
61
|
+
node_ref,
|
|
62
|
+
)
|
|
41
63
|
from braidio.weave_config import WeaveConfig
|
|
42
64
|
from braidio.transforms._ingest import ingest_script, IngestedScript
|
|
43
65
|
from braidio.transforms import ( # noqa: F401
|
|
@@ -66,7 +88,11 @@ from braidio.transforms._video_panels import (
|
|
|
66
88
|
tracks_for_episode,
|
|
67
89
|
)
|
|
68
90
|
from braidio.transforms._video_cut import (
|
|
91
|
+
content_keyed_prepare,
|
|
92
|
+
frames_dir,
|
|
93
|
+
panel_canvas,
|
|
69
94
|
panel_footage,
|
|
95
|
+
panel_source,
|
|
70
96
|
panel_path,
|
|
71
97
|
path_for_panel,
|
|
72
98
|
path_on_canvas,
|
|
@@ -111,6 +137,32 @@ __all__ = [
|
|
|
111
137
|
"path_for_panel",
|
|
112
138
|
"path_on_canvas",
|
|
113
139
|
"resolve_move",
|
|
140
|
+
# what a host reads the picture track with (braidio#146)
|
|
141
|
+
"content_keyed_prepare",
|
|
142
|
+
"frames_dir",
|
|
143
|
+
"panel_canvas",
|
|
144
|
+
"panel_source",
|
|
145
|
+
# reading the project graph: one index, a tier's ref, and every tier name
|
|
146
|
+
"graph_index",
|
|
147
|
+
"node_ref",
|
|
148
|
+
"TIER_WEAVE_CONFIG",
|
|
149
|
+
"TIER_PRODUCTION_STRUCTURE",
|
|
150
|
+
"TIER_RENDER_PROFILE",
|
|
151
|
+
"TIER_DIALOGUE_CAST",
|
|
152
|
+
"TIER_SOURCE_MEDIA",
|
|
153
|
+
"TIER_NARRATIVE_BEAT",
|
|
154
|
+
"TIER_DIALOGUE_BEAT",
|
|
155
|
+
"TIER_SCENE_BREAK",
|
|
156
|
+
"TIER_AUDIO_CLIP",
|
|
157
|
+
"TIER_VOICE_ASSIGNMENT",
|
|
158
|
+
"TIER_NARRATION_RENDER",
|
|
159
|
+
"TIER_DIALOGUE_RENDER",
|
|
160
|
+
"TIER_SEGMENT_EXTRACTION",
|
|
161
|
+
"TIER_EPISODE_RENDER",
|
|
162
|
+
"TIER_STILL",
|
|
163
|
+
"TIER_VIDEO_PANEL",
|
|
164
|
+
"TIER_VIDEO_CUT",
|
|
165
|
+
"TIER_LABEL_TRACK",
|
|
114
166
|
"VOICE_ASSIGNMENT_TRANSFORM",
|
|
115
167
|
"NARRATION_RENDER_TRANSFORM",
|
|
116
168
|
"DIALOGUE_RENDER_TRANSFORM",
|
|
@@ -57,6 +57,7 @@ into the delivered artifact.
|
|
|
57
57
|
from __future__ import annotations
|
|
58
58
|
|
|
59
59
|
import uuid
|
|
60
|
+
from pathlib import Path
|
|
60
61
|
from dataclasses import dataclass
|
|
61
62
|
from typing import Optional
|
|
62
63
|
|
|
@@ -109,6 +110,7 @@ from braidio.transforms._common import (
|
|
|
109
110
|
audio_artifact,
|
|
110
111
|
safe_duration,
|
|
111
112
|
file_url,
|
|
113
|
+
media_path,
|
|
112
114
|
url_to_path,
|
|
113
115
|
)
|
|
114
116
|
from braidio.transforms._segment import _pads_fades
|
|
@@ -120,12 +122,15 @@ NAME = "weave_to_episode.default"
|
|
|
120
122
|
_LABEL_SNIPPET_CHARS = 48
|
|
121
123
|
|
|
122
124
|
|
|
123
|
-
def _structure_and_bed(node: Annotation | None):
|
|
125
|
+
def _structure_and_bed(project_root, node: Annotation | None):
|
|
124
126
|
"""``(MusicStructure, MusicBed | None)`` from a ``production-structure`` node.
|
|
125
127
|
|
|
126
128
|
``None`` (no such node) resolves to braidio's inert default structure and no
|
|
127
129
|
bed — the pre-structure behaviour, reconstructed rather than special-cased
|
|
128
|
-
at every use site.
|
|
130
|
+
at every use site. The sting and bed audio are found by their asset id
|
|
131
|
+
first (:func:`media_path`), so a project moved to another machine still
|
|
132
|
+
reads them; one found nowhere, with a recorded url, is not an error *here*
|
|
133
|
+
(a timeline read never plays the bed), only where it is played.
|
|
129
134
|
"""
|
|
130
135
|
from braidio.music import MusicBed
|
|
131
136
|
from braidio.structure import DEFAULT_STRUCTURE, MusicStructure, Sting
|
|
@@ -134,14 +139,41 @@ def _structure_and_bed(node: Annotation | None):
|
|
|
134
139
|
return DEFAULT_STRUCTURE, None
|
|
135
140
|
body = node.body
|
|
136
141
|
sting = None
|
|
137
|
-
if body.get("sting_url"):
|
|
138
|
-
sting = Sting(
|
|
142
|
+
if body.get("sting_url") or body.get("sting_asset_id"):
|
|
143
|
+
sting = Sting(
|
|
144
|
+
str(_asset_path(project_root, body, "sting")), **(body.get("sting") or {})
|
|
145
|
+
)
|
|
139
146
|
bed = None
|
|
140
|
-
if body.get("bed_url"):
|
|
141
|
-
bed = MusicBed(
|
|
147
|
+
if body.get("bed_url") or body.get("bed_asset_id"):
|
|
148
|
+
bed = MusicBed(
|
|
149
|
+
str(_asset_path(project_root, body, "bed")), **(body.get("bed") or {})
|
|
150
|
+
)
|
|
142
151
|
return MusicStructure(sting=sting, **(body.get("structure") or {})), bed
|
|
143
152
|
|
|
144
153
|
|
|
154
|
+
def _asset_path(project_root, body: dict, asset: str) -> Path:
|
|
155
|
+
"""The file of a structure node's ``asset`` (``"sting"`` / ``"bed"``).
|
|
156
|
+
|
|
157
|
+
Found nowhere → the recorded location, unchecked, as before
|
|
158
|
+
:func:`media_path`: the caller that plays it is the one that fails.
|
|
159
|
+
"""
|
|
160
|
+
ref = {
|
|
161
|
+
"artifact_id": body.get(f"{asset}_asset_id"),
|
|
162
|
+
"url": body.get(f"{asset}_url"),
|
|
163
|
+
}
|
|
164
|
+
try:
|
|
165
|
+
return media_path(project_root, ref, what=f"production-structure {asset}")
|
|
166
|
+
except FileNotFoundError:
|
|
167
|
+
if not ref["url"]:
|
|
168
|
+
raise
|
|
169
|
+
return url_to_path(ref["url"])
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def _member_what(member: Annotation) -> str:
|
|
173
|
+
"""How an error names ``member``'s media."""
|
|
174
|
+
return f"{member.tier} {member.id}"
|
|
175
|
+
|
|
176
|
+
|
|
145
177
|
def _member_role(member: Annotation, index: dict, *, structure):
|
|
146
178
|
"""``(role, label, source_span)`` for one episode member — the timeline's
|
|
147
179
|
per-beat metadata, mirroring ``braidio.render``'s conventions exactly.
|
|
@@ -253,10 +285,12 @@ def _member_duration(project, member: Annotation, *, config: dict, structure) ->
|
|
|
253
285
|
return length + sting.gap_after_s
|
|
254
286
|
return float(structure.pause_s)
|
|
255
287
|
|
|
256
|
-
url
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
288
|
+
if member.body.get("url") or member.body.get("artifact_id"):
|
|
289
|
+
try:
|
|
290
|
+
path = media_path(project.root, member.body, what=_member_what(member))
|
|
291
|
+
except FileNotFoundError:
|
|
292
|
+
path = None # gone from disk: the arithmetic below
|
|
293
|
+
if path is not None:
|
|
260
294
|
return float(braidio.duration_s(path))
|
|
261
295
|
|
|
262
296
|
if member.tier == TIER_SEGMENT_EXTRACTION:
|
|
@@ -289,7 +323,8 @@ def episode_timeline(project, episode: Annotation) -> TimelineBreakdown:
|
|
|
289
323
|
cfg = singleton(project, TIER_WEAVE_CONFIG)
|
|
290
324
|
config = cfg.body.get("config", {})
|
|
291
325
|
structure, _bed = _structure_and_bed(
|
|
292
|
-
|
|
326
|
+
project.root,
|
|
327
|
+
next((p for p in parents if p.tier == TIER_PRODUCTION_STRUCTURE), None),
|
|
293
328
|
)
|
|
294
329
|
members = _resolve_members(
|
|
295
330
|
episode,
|
|
@@ -652,7 +687,8 @@ class WeaveToEpisode(BaseTransform):
|
|
|
652
687
|
cfg = require_tier(parents, TIER_WEAVE_CONFIG)
|
|
653
688
|
config = cfg.body.get("config", {})
|
|
654
689
|
structure, bed = _structure_and_bed(
|
|
655
|
-
|
|
690
|
+
project.root,
|
|
691
|
+
next((a for a in parents if a.tier == TIER_PRODUCTION_STRUCTURE), None),
|
|
656
692
|
)
|
|
657
693
|
weave = WeaveConfig.from_snapshot(config) # omitted knobs → the defaults
|
|
658
694
|
target_lufs = weave.target_lufs
|
|
@@ -666,6 +702,7 @@ class WeaveToEpisode(BaseTransform):
|
|
|
666
702
|
bed=bed,
|
|
667
703
|
target_lufs=target_lufs,
|
|
668
704
|
breaks_dir=breaks_dir,
|
|
705
|
+
project_root=project.root,
|
|
669
706
|
)
|
|
670
707
|
for m in members
|
|
671
708
|
]
|
|
@@ -735,6 +772,7 @@ class WeaveToEpisode(BaseTransform):
|
|
|
735
772
|
bed,
|
|
736
773
|
target_lufs: float,
|
|
737
774
|
breaks_dir,
|
|
775
|
+
project_root,
|
|
738
776
|
) -> TimelineItem:
|
|
739
777
|
"""One timeline part for ``member`` — a rendered beat, or a scene break.
|
|
740
778
|
|
|
@@ -760,7 +798,7 @@ class WeaveToEpisode(BaseTransform):
|
|
|
760
798
|
is_clip = member.tier == TIER_SEGMENT_EXTRACTION
|
|
761
799
|
return TimelineItem(
|
|
762
800
|
kind="clip" if is_clip else "narration",
|
|
763
|
-
path=str(
|
|
801
|
+
path=str(media_path(project_root, member.body, what=_member_what(member))),
|
|
764
802
|
placement="sequential",
|
|
765
803
|
speaker=_member_speaker(member, index),
|
|
766
804
|
spotlight=(
|
|
@@ -926,13 +926,20 @@ def _crop_still(
|
|
|
926
926
|
return dst
|
|
927
927
|
|
|
928
928
|
|
|
929
|
-
def
|
|
929
|
+
def content_keyed_prepare(workdir: Path, size: tuple[int, int]):
|
|
930
930
|
"""A ``prepare=`` for :func:`braidio.video.render_video` that names each
|
|
931
931
|
canvas by the source's **bytes** and the frame size — never by its
|
|
932
932
|
ordinal or its filename stem. ``render_video``'s default naming
|
|
933
933
|
(``{i:03d}_{stem}.jpg``) plus ``prepare_still``'s existing-file shortcut
|
|
934
934
|
would otherwise serve a stale canvas for a swapped still with the same
|
|
935
935
|
stem, or a landscape canvas to a vertical cut.
|
|
936
|
+
|
|
937
|
+
Returns ``prepare(src, dst_ignored, *, size=size) -> Path``: the canvas
|
|
938
|
+
for the picture at ``src``, written under ``workdir``. ``dst_ignored`` is
|
|
939
|
+
there only to fit ``render_video``'s ``prepare`` signature; a caller of
|
|
940
|
+
its own passes ``None``. To get the canvas a panel is framed on, call
|
|
941
|
+
:func:`panel_canvas` instead — it is this, over :func:`panel_source`, in
|
|
942
|
+
one call.
|
|
936
943
|
"""
|
|
937
944
|
from braidio.video import prepare_still
|
|
938
945
|
|
|
@@ -944,14 +951,26 @@ def _content_keyed_prepare(workdir: Path, size: tuple[int, int]):
|
|
|
944
951
|
return prepare
|
|
945
952
|
|
|
946
953
|
|
|
947
|
-
def
|
|
954
|
+
def frames_dir(project) -> Path:
|
|
948
955
|
"""Where prepared canvases and cropped stills are cached (shared by the
|
|
949
956
|
render and :func:`panel_path`, so a preview warms the render's cache)."""
|
|
950
957
|
return _cuts_dir(project) / "_frames"
|
|
951
958
|
|
|
952
959
|
|
|
953
|
-
def
|
|
954
|
-
"""The picture a panel shows: its still's bytes, after the still's crop.
|
|
960
|
+
def panel_source(project, panel: Annotation, index: dict, workdir: Path) -> Path:
|
|
961
|
+
"""The picture a panel shows: its still's bytes, after the still's crop.
|
|
962
|
+
|
|
963
|
+
``index`` is :func:`graph_index` of ``project`` (the panel's still is
|
|
964
|
+
looked up in it) and ``workdir`` is :func:`frames_dir` of ``project``
|
|
965
|
+
(where a cropped still is cached, shared with the render). Raises
|
|
966
|
+
``ValueError`` when the panel's ``still_id`` is not a still in ``index``
|
|
967
|
+
(or the still records neither an ``artifact_id`` nor a url), and
|
|
968
|
+
``FileNotFoundError`` when the still's bytes are reachable nowhere — not
|
|
969
|
+
in the catalog, not at the recorded url.
|
|
970
|
+
|
|
971
|
+
The source is not yet the canvas: :func:`panel_canvas` is the one call
|
|
972
|
+
for the prepared picture the render frames on.
|
|
973
|
+
"""
|
|
955
974
|
still = _still_of(panel, index)
|
|
956
975
|
return _crop_still(
|
|
957
976
|
_local_path(project, still, "still"),
|
|
@@ -962,6 +981,14 @@ def _panel_source(project, panel: Annotation, index: dict, workdir: Path) -> Pat
|
|
|
962
981
|
)
|
|
963
982
|
|
|
964
983
|
|
|
984
|
+
# The pre-#146 private names, which reelee's CURRENT adapter (reelee/_braidio.py)
|
|
985
|
+
# imports. Kept (as the same objects) so that adapter keeps importing; remove once
|
|
986
|
+
# reelee reads the public names (braidio#156).
|
|
987
|
+
_content_keyed_prepare = content_keyed_prepare
|
|
988
|
+
_frames_dir = frames_dir
|
|
989
|
+
_panel_source = panel_source
|
|
990
|
+
|
|
991
|
+
|
|
965
992
|
def panel_footage(project, panel: Annotation):
|
|
966
993
|
"""The recorded video a footage panel plays (a ``braidio.video.Footage``),
|
|
967
994
|
or ``None`` for a still panel.
|
|
@@ -1013,16 +1040,63 @@ def panel_path(project, panel: Annotation, *, size: tuple[int, int]):
|
|
|
1013
1040
|
predates footage keeps working, but the answer describes nothing in the film.
|
|
1014
1041
|
"""
|
|
1015
1042
|
resolver_identity() # refuses an old burns with the message the render gives
|
|
1016
|
-
size = (
|
|
1043
|
+
size = _delivery_size(size)
|
|
1017
1044
|
index = graph_index(project)
|
|
1018
1045
|
_check_stored_paths([panel], {"size": size}, [_still_of(panel, index)])
|
|
1019
|
-
|
|
1020
|
-
workdir.mkdir(parents=True, exist_ok=True)
|
|
1021
|
-
source = _panel_source(project, panel, index, workdir)
|
|
1022
|
-
canvas = _content_keyed_prepare(workdir, size)(source, None)
|
|
1046
|
+
source, canvas = _source_and_canvas(project, panel, size=size, index=index)
|
|
1023
1047
|
return _path_on_canvas(panel.body, canvas, source, aspect=size[0] / size[1])
|
|
1024
1048
|
|
|
1025
1049
|
|
|
1050
|
+
def panel_canvas(project, panel: Annotation, *, size: tuple[int, int]) -> Path:
|
|
1051
|
+
"""The prepared canvas the motion render and :func:`panel_path` frame
|
|
1052
|
+
``panel`` on at ``size`` — the same file, from the same cache.
|
|
1053
|
+
|
|
1054
|
+
The one call for "what picture does the camera move over?": a preview
|
|
1055
|
+
that draws this file under :func:`panel_path`'s move shows what the film
|
|
1056
|
+
shows. Rebuilding it from :func:`frames_dir`, :func:`panel_source` and
|
|
1057
|
+
:func:`content_keyed_prepare` works today but couples the caller to how
|
|
1058
|
+
the canvas is made; this does not.
|
|
1059
|
+
|
|
1060
|
+
``size`` is the delivery ``(width, height)`` (a JSON list is fine). Reads
|
|
1061
|
+
the still's bytes and writes the canvas (and any cropped still) into the
|
|
1062
|
+
project's frame cache.
|
|
1063
|
+
|
|
1064
|
+
Unlike :func:`panel_path`, this does **not** check the panel's stored
|
|
1065
|
+
path against ``size``: the canvas does not depend on the path, and a
|
|
1066
|
+
preview may show the picture before a path for this delivery exists.
|
|
1067
|
+
|
|
1068
|
+
Raises ``FileNotFoundError`` when the still's bytes are reachable nowhere
|
|
1069
|
+
(not in the catalog, not at the recorded url), and ``ValueError`` when the
|
|
1070
|
+
panel's ``still_id`` is not a still in the graph.
|
|
1071
|
+
|
|
1072
|
+
A footage panel plays its recording, over no canvas: check
|
|
1073
|
+
:func:`panel_footage` first. For one, this answers with its poster's
|
|
1074
|
+
canvas, which the film never shows.
|
|
1075
|
+
"""
|
|
1076
|
+
_, canvas = _source_and_canvas(
|
|
1077
|
+
project, panel, size=_delivery_size(size), index=graph_index(project)
|
|
1078
|
+
)
|
|
1079
|
+
return canvas
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
def _delivery_size(size) -> tuple[int, int]:
|
|
1083
|
+
"""``size`` as the ``(width, height)`` ints the canvas name is keyed on."""
|
|
1084
|
+
return (int(size[0]), int(size[1]))
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
def _source_and_canvas(
|
|
1088
|
+
project, panel: Annotation, *, size: tuple[int, int], index: dict
|
|
1089
|
+
) -> tuple[Path, Path]:
|
|
1090
|
+
"""``(source, canvas)`` for ``panel`` at ``size``: the cropped still and
|
|
1091
|
+
the prepared canvas over it. The only place a canvas is built outside the
|
|
1092
|
+
render, which builds the same one through ``prepare=``;
|
|
1093
|
+
``test_panel_canvas_is_the_canvas_the_render_frames_on`` pins that they agree."""
|
|
1094
|
+
workdir = frames_dir(project)
|
|
1095
|
+
workdir.mkdir(parents=True, exist_ok=True)
|
|
1096
|
+
source = panel_source(project, panel, index, workdir)
|
|
1097
|
+
return source, content_keyed_prepare(workdir, size)(source, None)
|
|
1098
|
+
|
|
1099
|
+
|
|
1026
1100
|
@register_transform(RENDER_NAME)
|
|
1027
1101
|
class VideoCutRender(BaseTransform):
|
|
1028
1102
|
"""Panels (+ their stills + the episode audio) → ``video-cut/v1`` (motion)."""
|
|
@@ -1105,11 +1179,11 @@ class VideoCutRender(BaseTransform):
|
|
|
1105
1179
|
fps = int(skel.body["settings"]["fps"])
|
|
1106
1180
|
aspect = size[0] / size[1]
|
|
1107
1181
|
|
|
1108
|
-
workdir =
|
|
1182
|
+
workdir = frames_dir(project)
|
|
1109
1183
|
video_panels = []
|
|
1110
1184
|
sources: list[Path] = []
|
|
1111
1185
|
for panel in panels:
|
|
1112
|
-
src =
|
|
1186
|
+
src = panel_source(project, panel, index, workdir)
|
|
1113
1187
|
sources.append(src)
|
|
1114
1188
|
start, end = _interval_s(panel)
|
|
1115
1189
|
video_panels.append(
|
|
@@ -1134,7 +1208,7 @@ class VideoCutRender(BaseTransform):
|
|
|
1134
1208
|
size=size,
|
|
1135
1209
|
fps=fps,
|
|
1136
1210
|
workdir=workdir,
|
|
1137
|
-
prepare=
|
|
1211
|
+
prepare=content_keyed_prepare(workdir, size), # = panel_path's
|
|
1138
1212
|
path_for=path_for,
|
|
1139
1213
|
)
|
|
1140
1214
|
artifact = media_artifact(
|
|
@@ -134,3 +134,24 @@ def test_import_braidio_core_does_not_require_graph():
|
|
|
134
134
|
# HAS_GRAPH may be True here, but the core API must be importable regardless.
|
|
135
135
|
for name in ("Script", "WeaveConfig", "render_production", "weave_timeline"):
|
|
136
136
|
assert hasattr(braidio, name)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_every_graph_tier_and_reader_is_public():
|
|
140
|
+
"""braidio#146: a host reads the graph through ``braidio.transforms``, never
|
|
141
|
+
a private module. Derived from ``_common``, so a new tier cannot be missed."""
|
|
142
|
+
pytest.importorskip("nw")
|
|
143
|
+
import braidio.transforms as public
|
|
144
|
+
from braidio.transforms import _common, _video_cut
|
|
145
|
+
|
|
146
|
+
tiers = {n for n in vars(_common) if n.startswith("TIER_")}
|
|
147
|
+
readers = {"graph_index", "node_ref"}
|
|
148
|
+
picture = {"content_keyed_prepare", "frames_dir", "panel_source", "panel_canvas"}
|
|
149
|
+
for name in tiers | readers:
|
|
150
|
+
assert getattr(public, name) is getattr(_common, name), name
|
|
151
|
+
for name in picture:
|
|
152
|
+
assert getattr(public, name) is getattr(_video_cut, name), name
|
|
153
|
+
assert (tiers | readers | picture) <= set(public.__all__)
|
|
154
|
+
# reelee's adapter (reelee/_braidio.py) imports these private names until
|
|
155
|
+
# reeleehq/braidio#156: they must stay the very public objects, not copies.
|
|
156
|
+
for private in ("_content_keyed_prepare", "_frames_dir", "_panel_source"):
|
|
157
|
+
assert getattr(_video_cut, private) is getattr(public, private[1:]), private
|
|
@@ -1335,3 +1335,156 @@ def test_genre_status_follows_the_project_from_empty_to_woven(
|
|
|
1335
1335
|
# and no string naming the project root — the episode's file:// url is left out)
|
|
1336
1336
|
assert nw.genre_status_of(project) == woven
|
|
1337
1337
|
assert str(project.root) not in repr(woven)
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
# --- the weave reads takes by content, not by recorded path (braidio#86) ---------
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
def test_a_reweave_reads_the_takes_by_artifact_id_when_their_urls_point_nowhere(
|
|
1344
|
+
project, script_and_source, patched_synthesis, monkeypatch
|
|
1345
|
+
):
|
|
1346
|
+
"""The server case for an imported project: every take's recorded url is
|
|
1347
|
+
the importing machine's path, so the weave must find each take through the
|
|
1348
|
+
delivery catalog, keyed by the ``artifact_id`` the graph already records,
|
|
1349
|
+
exactly as the stills do (braidio#89/#90)."""
|
|
1350
|
+
import shutil
|
|
1351
|
+
|
|
1352
|
+
import nw
|
|
1353
|
+
|
|
1354
|
+
from braidio.importing._catalog import CatalogReport, register_artifact
|
|
1355
|
+
from braidio.transforms._common import url_to_path
|
|
1356
|
+
|
|
1357
|
+
script, source = script_and_source
|
|
1358
|
+
braidio.weave_project(project, script, source=source)
|
|
1359
|
+
|
|
1360
|
+
takes = [
|
|
1361
|
+
a
|
|
1362
|
+
for tier in ("narration-renders", "segment-extractions")
|
|
1363
|
+
for a in nw.annotations_at_tier(project.root, tier)
|
|
1364
|
+
]
|
|
1365
|
+
for take in takes:
|
|
1366
|
+
original = url_to_path(take.body["url"])
|
|
1367
|
+
inside = project.root / "media" / original.name
|
|
1368
|
+
inside.parent.mkdir(parents=True, exist_ok=True)
|
|
1369
|
+
shutil.copy2(original, inside)
|
|
1370
|
+
register_artifact(
|
|
1371
|
+
project.root,
|
|
1372
|
+
inside,
|
|
1373
|
+
artifact_id=take.body["artifact_id"],
|
|
1374
|
+
kind="audio",
|
|
1375
|
+
generated_at="2026-11-02T00:00:00Z",
|
|
1376
|
+
report=CatalogReport(),
|
|
1377
|
+
)
|
|
1378
|
+
original.unlink()
|
|
1379
|
+
_rewrite_in_place(
|
|
1380
|
+
project,
|
|
1381
|
+
take,
|
|
1382
|
+
body={
|
|
1383
|
+
**take.body,
|
|
1384
|
+
"url": f"file:///Users/someone-else/gone/{original.name}",
|
|
1385
|
+
},
|
|
1386
|
+
)
|
|
1387
|
+
|
|
1388
|
+
woven = []
|
|
1389
|
+
|
|
1390
|
+
def _capture(items, out, **kw):
|
|
1391
|
+
woven.extend(items)
|
|
1392
|
+
Path(out).write_bytes(b"EPISODE")
|
|
1393
|
+
return Path(out)
|
|
1394
|
+
|
|
1395
|
+
monkeypatch.setattr(braidio, "weave_timeline", _capture)
|
|
1396
|
+
braidio.weave_project(project, script, source=source)
|
|
1397
|
+
|
|
1398
|
+
assert len(woven) == len(takes)
|
|
1399
|
+
assert all(Path(item.path).exists() for item in woven)
|
|
1400
|
+
assert not any("someone-else" in item.path for item in woven)
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
def test_the_sting_and_bed_are_read_by_asset_id_when_their_urls_point_nowhere(
|
|
1404
|
+
project, script_and_source, patched_synthesis, tmp_path
|
|
1405
|
+
):
|
|
1406
|
+
"""Same rule for the production-structure assets: ``*_asset_id`` first."""
|
|
1407
|
+
import nw
|
|
1408
|
+
|
|
1409
|
+
from braidio.importing._catalog import CatalogReport, register_artifact
|
|
1410
|
+
from braidio.transforms._episode import _structure_and_bed
|
|
1411
|
+
|
|
1412
|
+
_weave_with_sting_and_bed(project, script_and_source, tmp_path)
|
|
1413
|
+
(node,) = nw.annotations_at_tier(project.root, "production-structures")
|
|
1414
|
+
body = dict(node.body)
|
|
1415
|
+
for asset, name in (("sting", "hit.mp3"), ("bed", "bed.mp3")):
|
|
1416
|
+
inside = project.root / "media" / name
|
|
1417
|
+
inside.parent.mkdir(parents=True, exist_ok=True)
|
|
1418
|
+
(tmp_path / name).rename(inside)
|
|
1419
|
+
register_artifact(
|
|
1420
|
+
project.root,
|
|
1421
|
+
inside,
|
|
1422
|
+
artifact_id=body[f"{asset}_asset_id"],
|
|
1423
|
+
kind="audio",
|
|
1424
|
+
generated_at="2026-11-02T00:00:00Z",
|
|
1425
|
+
report=CatalogReport(),
|
|
1426
|
+
)
|
|
1427
|
+
body[f"{asset}_url"] = f"file:///Users/someone-else/gone/{name}"
|
|
1428
|
+
|
|
1429
|
+
structure, bed = _structure_and_bed(
|
|
1430
|
+
project.root, node.model_copy(update={"body": body})
|
|
1431
|
+
)
|
|
1432
|
+
|
|
1433
|
+
assert Path(structure.sting.asset_path).read_bytes() == b"STING-ASSET"
|
|
1434
|
+
assert Path(bed.asset_path).read_bytes() == b"BED-ASSET"
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
def test_a_reconstructed_timeline_probes_the_takes_found_in_the_catalog(
|
|
1438
|
+
project, script_and_source, patched_synthesis, monkeypatch
|
|
1439
|
+
):
|
|
1440
|
+
"""``episode_timeline`` on a row with no persisted timeline probes each
|
|
1441
|
+
take where ``media_path`` finds it, not at its recorded url."""
|
|
1442
|
+
import nw
|
|
1443
|
+
|
|
1444
|
+
from braidio.importing._catalog import CatalogReport, register_artifact
|
|
1445
|
+
from braidio.transforms import episode_timeline
|
|
1446
|
+
from braidio.transforms._common import url_to_path
|
|
1447
|
+
|
|
1448
|
+
script, source = script_and_source
|
|
1449
|
+
episode = braidio.weave_project(project, script, source=source)
|
|
1450
|
+
narration = nw.annotations_at_tier(project.root, "narration-renders")[0]
|
|
1451
|
+
original = url_to_path(narration.body["url"])
|
|
1452
|
+
inside = project.root / "media" / original.name
|
|
1453
|
+
inside.parent.mkdir(parents=True, exist_ok=True)
|
|
1454
|
+
original.rename(inside)
|
|
1455
|
+
register_artifact(
|
|
1456
|
+
project.root,
|
|
1457
|
+
inside,
|
|
1458
|
+
artifact_id=narration.body["artifact_id"],
|
|
1459
|
+
kind="audio",
|
|
1460
|
+
generated_at="2026-11-02T00:00:00Z",
|
|
1461
|
+
report=CatalogReport(),
|
|
1462
|
+
)
|
|
1463
|
+
probed = []
|
|
1464
|
+
monkeypatch.setattr(braidio, "duration_s", lambda p: probed.append(p) or 2.0)
|
|
1465
|
+
|
|
1466
|
+
stripped = {k: v for k, v in episode.body.items() if k != "timeline"}
|
|
1467
|
+
episode_timeline(project, episode.model_copy(update={"body": stripped}))
|
|
1468
|
+
|
|
1469
|
+
assert any(Path(p).parent.name == "blobs" for p in probed), probed
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
def test_a_missing_bed_does_not_fail_a_read_that_never_plays_it(
|
|
1473
|
+
project, script_and_source, patched_synthesis, tmp_path
|
|
1474
|
+
):
|
|
1475
|
+
"""Found nowhere, the sting and bed keep their recorded location unchecked:
|
|
1476
|
+
only the caller that plays them fails (a timeline read never does)."""
|
|
1477
|
+
import nw
|
|
1478
|
+
|
|
1479
|
+
from braidio.transforms._common import url_to_path
|
|
1480
|
+
from braidio.transforms._episode import _structure_and_bed
|
|
1481
|
+
|
|
1482
|
+
_weave_with_sting_and_bed(project, script_and_source, tmp_path)
|
|
1483
|
+
(node,) = nw.annotations_at_tier(project.root, "production-structures")
|
|
1484
|
+
(tmp_path / "bed.mp3").unlink()
|
|
1485
|
+
(tmp_path / "hit.mp3").unlink()
|
|
1486
|
+
|
|
1487
|
+
structure, bed = _structure_and_bed(project.root, node)
|
|
1488
|
+
|
|
1489
|
+
assert Path(bed.asset_path) == url_to_path(node.body["bed_url"])
|
|
1490
|
+
assert Path(structure.sting.asset_path) == url_to_path(node.body["sting_url"])
|
|
@@ -2291,6 +2291,56 @@ def test_panel_path_is_the_path_the_render_uses(
|
|
|
2291
2291
|
assert panel_path(project, panels[1], size=list(size)) == seen[1]
|
|
2292
2292
|
|
|
2293
2293
|
|
|
2294
|
+
def test_panel_canvas_is_the_canvas_the_render_frames_on(
|
|
2295
|
+
project, episode, stills, panels, monkeypatch, tmp_path
|
|
2296
|
+
):
|
|
2297
|
+
""":func:`panel_canvas` is the very file ``video_cut.render`` prepares for
|
|
2298
|
+
each panel (the one :func:`panel_path` resolves its move on), so a preview
|
|
2299
|
+
drawing it under the move shows the film's picture — braidio#146."""
|
|
2300
|
+
pytest.importorskip("burns")
|
|
2301
|
+
PIL = pytest.importorskip("PIL.Image")
|
|
2302
|
+
import braidio.video
|
|
2303
|
+
from braidio.transforms import VIDEO_CUT_RENDER_TRANSFORM, panel_canvas
|
|
2304
|
+
|
|
2305
|
+
np = pytest.importorskip("numpy")
|
|
2306
|
+
tex = np.random.default_rng(5).integers(0, 255, (60, 40, 3), dtype=np.uint8)
|
|
2307
|
+
portrait = tmp_path / "portrait.png"
|
|
2308
|
+
PIL.fromarray(np.kron(tex, np.ones((4, 4, 1), dtype=np.uint8))).save(portrait)
|
|
2309
|
+
cropped = add_still(
|
|
2310
|
+
project,
|
|
2311
|
+
portrait,
|
|
2312
|
+
key="portrait",
|
|
2313
|
+
labelled=False,
|
|
2314
|
+
crop={"x": 0.1, "y": 0.05, "w": 0.8, "h": 0.7},
|
|
2315
|
+
)
|
|
2316
|
+
swapped = _rewrite_in_place(
|
|
2317
|
+
project, panels[1], body={**panels[1].body, "still_id": str(cropped.id)}
|
|
2318
|
+
)
|
|
2319
|
+
panels = [panels[0], swapped, *panels[2:]]
|
|
2320
|
+
prepared = []
|
|
2321
|
+
|
|
2322
|
+
def _render_video(vpanels, *, out_path, size, workdir, prepare, **kw):
|
|
2323
|
+
for i, vp in enumerate(vpanels):
|
|
2324
|
+
prepared.append(
|
|
2325
|
+
Path(prepare(vp.still, Path(workdir) / f"{i}.jpg", size=size))
|
|
2326
|
+
)
|
|
2327
|
+
return _write(out_path, b"MOTION")
|
|
2328
|
+
|
|
2329
|
+
monkeypatch.setattr(braidio.video, "render_video", _render_video)
|
|
2330
|
+
cut = _run(VIDEO_CUT_RENDER_TRANSFORM, project, *panels).annotations[0]
|
|
2331
|
+
size = tuple(cut.body["settings"]["size"])
|
|
2332
|
+
canvases = [panel_canvas(project, p, size=size) for p in panels]
|
|
2333
|
+
assert prepared and canvases == prepared
|
|
2334
|
+
for canvas in canvases:
|
|
2335
|
+
assert canvas.is_file()
|
|
2336
|
+
with PIL.open(canvas) as img:
|
|
2337
|
+
assert img.size == size
|
|
2338
|
+
# JSON callers send the size as a list; the answer is the same file
|
|
2339
|
+
assert panel_canvas(project, panels[1], size=list(size)) == prepared[1]
|
|
2340
|
+
# ... and as floats: the canvas name is keyed on the int size
|
|
2341
|
+
assert panel_canvas(project, panels[1], size=[float(v) for v in size]) == prepared[1]
|
|
2342
|
+
|
|
2343
|
+
|
|
2294
2344
|
# --- media by content, not by recorded path (thorwhalen/braidio#89) --------------
|
|
2295
2345
|
|
|
2296
2346
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{braidio-0.0.89 → braidio-0.0.91}/misc/docs/research/notebooklm-and-conversational-pacing.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|