braidio 0.0.96__tar.gz → 0.0.97__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.96 → braidio-0.0.97}/PKG-INFO +1 -1
- {braidio-0.0.96 → braidio-0.0.97}/braidio/project.py +24 -6
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_common.py +29 -8
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_narration.py +3 -2
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_voice.py +32 -1
- {braidio-0.0.96 → braidio-0.0.97}/pyproject.toml +1 -1
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_mcp.py +11 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_transforms.py +98 -0
- {braidio-0.0.96 → braidio-0.0.97}/.editorconfig +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/.gitattributes +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/.gitignore +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/LICENSE +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/README.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/__init__.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/_paths.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/bodies/__init__.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/bodies/_domain.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/bodies/_render_nodes.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/bodies/_tiers.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/bodies/_video.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/captions.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/compose.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/conversation.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/cost.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/data/skills/braidio/SKILL.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/data/skills/braidio-commentary-video/SKILL.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/defaults.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/delivery.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/downloads.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/formats.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/genre.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/importing/__init__.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/importing/__main__.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/importing/_catalog.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/importing/_manifest.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/importing/_writer.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/kinds.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/leveling.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/markdown_script.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/__init__.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/_docs.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/_guide.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/_helpers.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/_media.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/credentials.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/metering.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/tools.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/mcp/workspace.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/multivoice.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/music.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/pacing.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/provenance.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/relevance.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/render.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/rights.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/script.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/sources.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/structure.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/style.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/textprep.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/timeline.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/__init__.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_asset_refs.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_dialogue.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_episode.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_ingest.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_segment.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_video_cut.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/transforms/_video_panels.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/tts.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/video.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/voice_library.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/weave.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/braidio/weave_config.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/conftest.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/Extraction and nw-App Design.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/research/commentary-formats-and-styles.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/research/conversational-vs-narration-tts.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/research/notebooklm-and-conversational-pacing.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/README.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/anti-platitude-checklist.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/commentary-voice-guide.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/_style-groups.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/amanda-dobbins.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/david-sims.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/griffin-newman.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/helen-molesworth.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/hrishikesh-hirway.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/jason-mantzoukas.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/john-mcwhorter.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/jon-caramanica.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/june-diane-raphael.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/karina-longworth.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/katy-hessel.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/louis-theroux.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/mallory-rubin.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/melvyn-bragg.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/michael-barbaro.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/nate-sloan-charlie-harding.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/paul-scheer.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/sean-fennessey.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/talk-art.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/style/voices/yasi-salek.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/misc/docs/youtube_ingest_credentials.md +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/_audio.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_body_schema_stability.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_conversation.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_cost.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_credits_card.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_defaults.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_delivery.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_downloads.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_expressiveness.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_formats.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_genre_placement.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_graph_speak.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_importing.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_leveling.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_markdown_script.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_mcp_caller_key.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_media_auth.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_multivoice.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_music.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_namespaced_source.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_nw_app.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_pacing.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_packaging.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_render_settings.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_script.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_sources.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_speak_seam.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_structure.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_textprep_style.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_timeline.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_transforms_dialogue.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_transforms_episode_members.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_transforms_rights.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_transforms_secrets.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_transforms_structure.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_tts_api_key.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_turn_overlap.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_video.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_video_bodies.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_video_footage.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_video_transforms.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_voice_library.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_weave.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_weave_config.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/tests/test_weave_master.py +0 -0
- {braidio-0.0.96 → braidio-0.0.97}/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.97
|
|
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
|
|
@@ -61,8 +61,9 @@ class Project(nw.Project):
|
|
|
61
61
|
def episodes(self) -> list:
|
|
62
62
|
"""The project's finished episodes (``episode-renders`` nodes), oldest first.
|
|
63
63
|
|
|
64
|
-
A re-weave adds an episode and keeps the earlier ones
|
|
65
|
-
the current one
|
|
64
|
+
A re-weave adds an episode and keeps the earlier ones. The last is NOT
|
|
65
|
+
necessarily the current one — a revert re-weaves to an older episode;
|
|
66
|
+
see :meth:`current_episode`.
|
|
66
67
|
"""
|
|
67
68
|
tiers = _tiers()
|
|
68
69
|
return sorted(
|
|
@@ -71,14 +72,30 @@ class Project(nw.Project):
|
|
|
71
72
|
key=lambda a: (a.provenance.generated_at_time.to_seconds(), str(a.id)),
|
|
72
73
|
)
|
|
73
74
|
|
|
75
|
+
def current_episode(self, *, episodes=None):
|
|
76
|
+
"""The episode the script currently weaves to, or ``None`` if none.
|
|
77
|
+
|
|
78
|
+
The most recent **fresh** episode, else the most recent
|
|
79
|
+
(:func:`braidio.transforms._common.freshest`, the rule every "current
|
|
80
|
+
node" reader shares). After an edit and its revert, ``weave_project``
|
|
81
|
+
returns the ORIGINAL episode again, which is older than the edited cut
|
|
82
|
+
but the only fresh one (braidio#169). ``episodes``: the list
|
|
83
|
+
:meth:`episodes` returned, when the caller already has it.
|
|
84
|
+
"""
|
|
85
|
+
if episodes is None:
|
|
86
|
+
episodes = self.episodes()
|
|
87
|
+
return _tiers().freshest(self, episodes)
|
|
88
|
+
|
|
74
89
|
def genre_status(self) -> dict:
|
|
75
90
|
"""Where this production stands, for a host's one ``project_status`` door
|
|
76
91
|
(``nw.Project.genre_status``, nw#133; braidio#125).
|
|
77
92
|
|
|
78
93
|
Counted, in muvid's shape: the script's beats by kind, how many episodes
|
|
79
|
-
were rendered, the
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
were rendered, the current one as ``latest_episode`` (path-free; the
|
|
95
|
+
wire name predates "current", see :meth:`current_episode`), and the
|
|
96
|
+
next step as ``{"op", "why"}``. Indexed tier reads — plus one freshness
|
|
97
|
+
walk, only once there is more than one episode to choose from — no file
|
|
98
|
+
probe, and no per-item list, so it stays small however often the
|
|
82
99
|
project is re-woven, and never names a path.
|
|
83
100
|
|
|
84
101
|
>>> import tempfile
|
|
@@ -98,6 +115,7 @@ class Project(nw.Project):
|
|
|
98
115
|
)
|
|
99
116
|
}
|
|
100
117
|
episodes = self.episodes()
|
|
118
|
+
current = self.current_episode(episodes=episodes)
|
|
101
119
|
if episodes:
|
|
102
120
|
op, why = NEXT_STEP_DONE
|
|
103
121
|
elif any(counts.values()):
|
|
@@ -107,7 +125,7 @@ class Project(nw.Project):
|
|
|
107
125
|
return {
|
|
108
126
|
**counts,
|
|
109
127
|
"episode_count": len(episodes),
|
|
110
|
-
"latest_episode": _episode_row(
|
|
128
|
+
"latest_episode": _episode_row(current) if current else None,
|
|
111
129
|
"next_step": {"op": op, "why": why},
|
|
112
130
|
}
|
|
113
131
|
|
|
@@ -215,10 +215,34 @@ def fresh_equivalent(project, skeleton: Annotation) -> Annotation | None:
|
|
|
215
215
|
]
|
|
216
216
|
if not candidates:
|
|
217
217
|
return None
|
|
218
|
-
fresh =
|
|
218
|
+
fresh = fresh_ids(project)
|
|
219
|
+
return next((a for a in reversed(candidates) if a.id in fresh), None)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def fresh_ids(project) -> set:
|
|
223
|
+
"""The ids of every annotation nw's freshness walk verifies as fresh."""
|
|
224
|
+
import nw
|
|
225
|
+
|
|
226
|
+
return {
|
|
219
227
|
v.annotation.id for v in nw.stale_verdicts_all(project.root) if not v.is_stale
|
|
220
228
|
}
|
|
221
|
-
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def freshest(project, annotations):
|
|
232
|
+
"""The current one of ``annotations`` (oldest first): the most recent
|
|
233
|
+
**fresh** one, else the most recent; ``None`` when there are none.
|
|
234
|
+
|
|
235
|
+
The one rule for "the current node" when a tier holds several candidates
|
|
236
|
+
(braidio#169): a parent rewritten and then rewritten back (an edit, then
|
|
237
|
+
its revert) makes an OLDER node fresh again while the newest reads stale,
|
|
238
|
+
so store or generation order alone names the wrong one. Walks freshness
|
|
239
|
+
only when there is a choice to make.
|
|
240
|
+
"""
|
|
241
|
+
annotations = list(annotations)
|
|
242
|
+
if len(annotations) <= 1:
|
|
243
|
+
return annotations[-1] if annotations else None
|
|
244
|
+
fresh = fresh_ids(project)
|
|
245
|
+
return next((a for a in reversed(annotations) if a.id in fresh), annotations[-1])
|
|
222
246
|
|
|
223
247
|
|
|
224
248
|
def adopt_output(skeleton: Annotation, hit: Annotation) -> Annotation:
|
|
@@ -403,18 +427,15 @@ def asset_ref(path: str | Path) -> tuple[str, str]:
|
|
|
403
427
|
return artifact.asset_id, file_url(path)
|
|
404
428
|
|
|
405
429
|
|
|
406
|
-
def
|
|
407
|
-
"""
|
|
430
|
+
def children_at_tier(project, tier: str, parent_id) -> list:
|
|
431
|
+
"""Every ``tier`` annotation derived from ``parent_id``, in store order."""
|
|
408
432
|
import nw
|
|
409
433
|
|
|
410
|
-
|
|
434
|
+
return [
|
|
411
435
|
a
|
|
412
436
|
for a in nw.annotations_at_tier(project.root, tier)
|
|
413
437
|
if parent_id in a.provenance.was_derived_from
|
|
414
438
|
]
|
|
415
|
-
if not hits:
|
|
416
|
-
raise ValueError(f"no {tier!r} node derived from {parent_id}")
|
|
417
|
-
return hits[-1]
|
|
418
439
|
|
|
419
440
|
|
|
420
441
|
def resolve_parents(skeleton: Annotation, index: dict) -> list:
|
|
@@ -54,7 +54,6 @@ from braidio.transforms._common import (
|
|
|
54
54
|
TIER_WEAVE_CONFIG,
|
|
55
55
|
TIER_NARRATION_RENDER,
|
|
56
56
|
beat_ordinal,
|
|
57
|
-
child_at_tier,
|
|
58
57
|
singleton,
|
|
59
58
|
graph_index,
|
|
60
59
|
resolve_parents,
|
|
@@ -68,6 +67,8 @@ from braidio.transforms._common import (
|
|
|
68
67
|
elevenlabs_key,
|
|
69
68
|
)
|
|
70
69
|
|
|
70
|
+
from braidio.transforms._voice import current_voice_assignment
|
|
71
|
+
|
|
71
72
|
NAME = "narration_render.tts"
|
|
72
73
|
|
|
73
74
|
|
|
@@ -237,7 +238,7 @@ class NarrationRenderTTS(BaseTransform):
|
|
|
237
238
|
) -> tuple[Plan, tuple[Annotation, ...]]:
|
|
238
239
|
beat = inputs.primary[0]
|
|
239
240
|
cfg = singleton(project, TIER_WEAVE_CONFIG)
|
|
240
|
-
va =
|
|
241
|
+
va = current_voice_assignment(project, beat)
|
|
241
242
|
cache_key = _render_inputs(beat, va, cfg).cache_key(self)
|
|
242
243
|
|
|
243
244
|
full = TransformInputs(
|
|
@@ -15,7 +15,6 @@ documented follow-up.
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
import uuid
|
|
18
|
-
from typing import Optional
|
|
19
18
|
|
|
20
19
|
from falaw import Plan
|
|
21
20
|
from lacing import Annotation
|
|
@@ -33,7 +32,9 @@ from braidio.weave_config import WeaveConfig
|
|
|
33
32
|
from braidio.transforms._common import (
|
|
34
33
|
TIER_VOICE_ASSIGNMENT,
|
|
35
34
|
beat_ordinal,
|
|
35
|
+
children_at_tier,
|
|
36
36
|
fresh_equivalent,
|
|
37
|
+
freshest,
|
|
37
38
|
singleton,
|
|
38
39
|
)
|
|
39
40
|
|
|
@@ -104,3 +105,33 @@ class BeatToVoiceAssignment(BaseTransform):
|
|
|
104
105
|
cost_usd_actual=0.0,
|
|
105
106
|
cache_hit_savings_usd=0.0,
|
|
106
107
|
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def current_voice_assignment(project, beat: Annotation) -> Annotation:
|
|
111
|
+
"""The voice-assignment the voice stage would choose for ``beat`` now.
|
|
112
|
+
|
|
113
|
+
Its plan is free (no synthesis), so plan it and take the fresh node that
|
|
114
|
+
plan would only duplicate — exactly what :meth:`BeatToVoiceAssignment.execute`
|
|
115
|
+
reuses. "The most recent fresh one" cannot stand in for that: the voice
|
|
116
|
+
may come from the environment (``BRAIDIO_TTS_VOICE``, which no node
|
|
117
|
+
records), so after a voice flip A→B→A both assignments are fresh and only
|
|
118
|
+
the plan knows which one is current (braidio#169).
|
|
119
|
+
|
|
120
|
+
A single assignment is the answer without planning: the voice stage either
|
|
121
|
+
chose it or would have added a second. When the plan has no fresh
|
|
122
|
+
equivalent — a driver ran narration without running the voice stage
|
|
123
|
+
first — fall back to :func:`freshest` over the beat's assignments.
|
|
124
|
+
"""
|
|
125
|
+
hits = children_at_tier(project, TIER_VOICE_ASSIGNMENT, beat.id)
|
|
126
|
+
if not hits:
|
|
127
|
+
raise ValueError(f"no {TIER_VOICE_ASSIGNMENT!r} node derived from {beat.id}")
|
|
128
|
+
if len(hits) == 1:
|
|
129
|
+
return hits[0]
|
|
130
|
+
import nw
|
|
131
|
+
|
|
132
|
+
# the registered voice stage, so a genre that swaps it is followed too
|
|
133
|
+
voice = nw.get_transform(NAME)
|
|
134
|
+
_plan, (skeleton,) = voice.plan(project, TransformInputs(primary=(beat,)))
|
|
135
|
+
chosen = fresh_equivalent(project, skeleton)
|
|
136
|
+
# no fresh equivalent: the voice stage did not run for this plan
|
|
137
|
+
return chosen if chosen is not None else freshest(project, hits)
|
|
@@ -726,6 +726,17 @@ def test_project_status_serves_the_genre_status_plus_full_episodes(
|
|
|
726
726
|
assert row["episode_id"] == str(episode.id)
|
|
727
727
|
assert row["url"].startswith("file://")
|
|
728
728
|
|
|
729
|
+
# an edit and its revert: the revert re-weaves to the ORIGINAL episode, so
|
|
730
|
+
# the status's latest_episode is that one, not the newer edited cut (#169)
|
|
731
|
+
edited = braidio.Script(
|
|
732
|
+
title="Demo", id_slug="demo", beats=[braidio.Narration(text="Hi there.")]
|
|
733
|
+
)
|
|
734
|
+
braidio.weave_project(proj, edited)
|
|
735
|
+
assert braidio.weave_project(proj, script).id == episode.id
|
|
736
|
+
out = _call(server, "project_status", {"project_id": "demo"}).structured_content
|
|
737
|
+
assert out["episode_count"] == 2
|
|
738
|
+
assert out["latest_episode"]["episode_id"] == str(episode.id)
|
|
739
|
+
|
|
729
740
|
|
|
730
741
|
@_NW
|
|
731
742
|
def test_weave_project_records_cost(monkeypatch):
|
|
@@ -1567,3 +1567,101 @@ def test_a_failed_weave_carries_what_it_spent_on_its_exception(
|
|
|
1567
1567
|
tts_cost_usd(first_line, model_id=DEFAULT_MODEL_ID)
|
|
1568
1568
|
)
|
|
1569
1569
|
assert receipt.has_unknown_costs
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
def test_a_reweave_after_an_edit_and_its_revert_settles(
|
|
1573
|
+
project, script_and_source, patched_synthesis
|
|
1574
|
+
):
|
|
1575
|
+
"""braidio#169: edit beat 0, re-weave, revert it, re-weave: a further
|
|
1576
|
+
re-weave with nothing changed is a no-op, like any other."""
|
|
1577
|
+
import dataclasses
|
|
1578
|
+
|
|
1579
|
+
import nw
|
|
1580
|
+
|
|
1581
|
+
script, source = script_and_source
|
|
1582
|
+
edited = dataclasses.replace(
|
|
1583
|
+
script, beats=[braidio.Narration(text="Edited opening."), *script.beats[1:]]
|
|
1584
|
+
)
|
|
1585
|
+
braidio.weave_project(project, script, source=source)
|
|
1586
|
+
braidio.weave_project(project, edited, source=source)
|
|
1587
|
+
reverted = braidio.weave_project(project, script, source=source)
|
|
1588
|
+
before = {a.id for a in nw.iter_all_annotations(project.root)}
|
|
1589
|
+
|
|
1590
|
+
again = braidio.weave_project(project, script, source=source)
|
|
1591
|
+
|
|
1592
|
+
assert again.id == reverted.id
|
|
1593
|
+
assert {a.id for a in nw.iter_all_annotations(project.root)} == before
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
def test_a_revert_reuses_the_original_take_without_synthesis(
|
|
1597
|
+
project, script_and_source, patched_synthesis, monkeypatch
|
|
1598
|
+
):
|
|
1599
|
+
"""The reverted text's original take is fresh again: reverting re-weaves
|
|
1600
|
+
over it rather than synthesizing (or adopting) a new one."""
|
|
1601
|
+
import dataclasses
|
|
1602
|
+
|
|
1603
|
+
script, source = script_and_source
|
|
1604
|
+
edited = dataclasses.replace(
|
|
1605
|
+
script, beats=[braidio.Narration(text="Edited opening."), *script.beats[1:]]
|
|
1606
|
+
)
|
|
1607
|
+
first = braidio.weave_project(project, script, source=source)
|
|
1608
|
+
braidio.weave_project(project, edited, source=source)
|
|
1609
|
+
spoken = []
|
|
1610
|
+
real = braidio.narrate
|
|
1611
|
+
monkeypatch.setattr(
|
|
1612
|
+
braidio, "narrate", lambda t, o, **kw: spoken.append(t) or real(t, o, **kw)
|
|
1613
|
+
)
|
|
1614
|
+
reverted = braidio.weave_project(project, script, source=source)
|
|
1615
|
+
assert spoken == []
|
|
1616
|
+
assert reverted.body["ordered_member_ids"][0] == first.body["ordered_member_ids"][0]
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
def test_a_voice_flip_and_back_weaves_in_the_voice_the_voice_stage_chose(
|
|
1620
|
+
project, script_and_source, patched_synthesis, monkeypatch
|
|
1621
|
+
):
|
|
1622
|
+
"""braidio#169: the default voice comes from the environment, which no
|
|
1623
|
+
node records, so after A→B→A both voice-assignments are FRESH. The
|
|
1624
|
+
narration must use the one the voice stage chose — not merely the most
|
|
1625
|
+
recent fresh one (that is B), nor the oldest (wrong again on →B)."""
|
|
1626
|
+
script, source = script_and_source
|
|
1627
|
+
voice_of_take = {} # the synthesized file's stem (its render's id) → voice
|
|
1628
|
+
stub = braidio.narrate
|
|
1629
|
+
|
|
1630
|
+
def spy(text, out, **kw):
|
|
1631
|
+
voice_of_take[Path(out).stem] = kw.get("voice_id")
|
|
1632
|
+
return stub(text, out, **kw)
|
|
1633
|
+
|
|
1634
|
+
monkeypatch.setattr(braidio, "narrate", spy)
|
|
1635
|
+
|
|
1636
|
+
def opening_voice(voice):
|
|
1637
|
+
monkeypatch.setenv("BRAIDIO_TTS_VOICE", voice)
|
|
1638
|
+
episode = braidio.weave_project(project, script, source=source)
|
|
1639
|
+
return voice_of_take[episode.body["ordered_member_ids"][0]]
|
|
1640
|
+
|
|
1641
|
+
assert opening_voice("voiceA") == "voiceA"
|
|
1642
|
+
assert opening_voice("voiceB") == "voiceB"
|
|
1643
|
+
assert opening_voice("voiceA") == "voiceA" # not the most recent fresh
|
|
1644
|
+
assert opening_voice("voiceB") == "voiceB" # not the oldest fresh
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
def test_genre_status_names_the_episode_a_revert_returned(
|
|
1648
|
+
project, script_and_source, patched_synthesis
|
|
1649
|
+
):
|
|
1650
|
+
"""After weave → edit → revert, the revert returns the ORIGINAL episode,
|
|
1651
|
+
older than the edited cut: the status's current episode is that one, not
|
|
1652
|
+
the newest by generation time (braidio#169)."""
|
|
1653
|
+
import dataclasses
|
|
1654
|
+
|
|
1655
|
+
script, source = script_and_source
|
|
1656
|
+
edited = dataclasses.replace(
|
|
1657
|
+
script, beats=[braidio.Narration(text="Edited opening."), *script.beats[1:]]
|
|
1658
|
+
)
|
|
1659
|
+
first = braidio.weave_project(project, script, source=source)
|
|
1660
|
+
cut = braidio.weave_project(project, edited, source=source)
|
|
1661
|
+
reverted = braidio.weave_project(project, script, source=source)
|
|
1662
|
+
|
|
1663
|
+
assert reverted.id == first.id and project.episodes()[-1].id == cut.id
|
|
1664
|
+
assert project.current_episode().id == first.id
|
|
1665
|
+
status = project.genre_status()
|
|
1666
|
+
assert status["episode_count"] == 2
|
|
1667
|
+
assert status["latest_episode"]["episode_id"] == str(first.id)
|
|
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.96 → braidio-0.0.97}/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
|
|
File without changes
|