braidio 0.0.78__tar.gz → 0.0.80__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.78 → braidio-0.0.80}/PKG-INFO +1 -1
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/tools.py +14 -7
- braidio-0.0.80/braidio/project.py +60 -0
- {braidio-0.0.78 → braidio-0.0.80}/pyproject.toml +1 -1
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_mcp.py +0 -41
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_transforms.py +0 -53
- braidio-0.0.78/braidio/project.py +0 -144
- {braidio-0.0.78 → braidio-0.0.80}/.editorconfig +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/.gitattributes +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/.gitignore +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/LICENSE +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/README.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/__init__.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/_paths.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/bodies/__init__.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/bodies/_domain.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/bodies/_render_nodes.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/bodies/_tiers.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/bodies/_video.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/captions.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/compose.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/conversation.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/cost.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/data/skills/braidio/SKILL.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/data/skills/braidio-commentary-video/SKILL.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/defaults.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/delivery.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/downloads.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/formats.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/genre.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/importing/__init__.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/importing/__main__.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/importing/_catalog.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/importing/_manifest.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/importing/_writer.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/kinds.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/markdown_script.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/__init__.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/_docs.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/_guide.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/_helpers.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/_media.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/credentials.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/metering.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/mcp/workspace.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/multivoice.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/music.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/pacing.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/provenance.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/relevance.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/render.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/rights.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/script.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/sources.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/structure.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/style.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/textprep.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/timeline.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/__init__.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_asset_refs.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_common.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_dialogue.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_episode.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_ingest.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_narration.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_segment.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_video_cut.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_video_panels.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/transforms/_voice.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/tts.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/video.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/voice_library.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/weave.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/braidio/weave_config.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/conftest.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/Extraction and nw-App Design.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/research/commentary-formats-and-styles.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/research/conversational-vs-narration-tts.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/research/notebooklm-and-conversational-pacing.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/README.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/anti-platitude-checklist.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/commentary-voice-guide.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/_style-groups.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/amanda-dobbins.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/david-sims.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/griffin-newman.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/helen-molesworth.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/hrishikesh-hirway.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/jason-mantzoukas.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/john-mcwhorter.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/jon-caramanica.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/june-diane-raphael.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/karina-longworth.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/katy-hessel.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/louis-theroux.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/mallory-rubin.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/melvyn-bragg.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/michael-barbaro.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/nate-sloan-charlie-harding.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/paul-scheer.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/sean-fennessey.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/talk-art.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/style/voices/yasi-salek.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/misc/docs/youtube_ingest_credentials.md +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/_audio.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_body_schema_stability.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_conversation.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_cost.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_credits_card.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_defaults.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_delivery.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_downloads.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_expressiveness.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_formats.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_genre_placement.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_importing.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_markdown_script.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_mcp_caller_key.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_media_auth.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_multivoice.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_music.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_namespaced_source.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_nw_app.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_pacing.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_packaging.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_render_settings.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_script.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_sources.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_structure.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_textprep_style.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_timeline.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_transforms_dialogue.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_transforms_episode_members.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_transforms_rights.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_transforms_secrets.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_transforms_structure.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_tts_api_key.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_turn_overlap.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_video.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_video_bodies.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_video_footage.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_video_transforms.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_voice_library.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_weave.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/tests/test_weave_config.py +0 -0
- {braidio-0.0.78 → braidio-0.0.80}/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.80
|
|
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
|
|
@@ -323,16 +323,23 @@ def list_projects() -> dict:
|
|
|
323
323
|
|
|
324
324
|
|
|
325
325
|
def project_status(project_id: str) -> dict:
|
|
326
|
-
"""A project's status:
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
"""A project's status: its finished episode renders (url + duration), if any.
|
|
327
|
+
|
|
328
|
+
Each episode row carries ``episode_id`` — the id ``resolve`` accepts and a
|
|
329
|
+
download claim is minted against. The body's own ``artifact_id`` is the
|
|
330
|
+
lacing CONTENT hash: an identity for provenance, not a retrieval key
|
|
331
|
+
(braidio#32 — the tool used to return only the body, so the one id a
|
|
332
|
+
caller could see was the one no download tool accepted).
|
|
329
333
|
"""
|
|
330
334
|
_require_nw("project_status")
|
|
335
|
+
import nw
|
|
336
|
+
|
|
331
337
|
proj = _workspace().open_project(project_id)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
338
|
+
episodes = [
|
|
339
|
+
{"episode_id": str(a.id), **to_json(a.body)}
|
|
340
|
+
for a in nw.annotations_at_tier(proj.root, "episode-renders")
|
|
341
|
+
]
|
|
342
|
+
return {"project_id": project_id, "episodes": episodes}
|
|
336
343
|
|
|
337
344
|
|
|
338
345
|
#: Content types whose extracted text has lost its markdown structure, so
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""braidio as an nw app: a :class:`nw.Project` for commentary-weave productions.
|
|
2
|
+
|
|
3
|
+
Subclassing ``nw.Project`` inherits the whole folder facade + lacing graph +
|
|
4
|
+
freshness (``stale_after``) machinery; braidio adds its production kind and its
|
|
5
|
+
domain/render body-schema vocabulary (registered on import of
|
|
6
|
+
:mod:`braidio.bodies`). This module requires ``nw``; it is imported lazily by
|
|
7
|
+
``braidio/__init__`` only when ``nw`` is available.
|
|
8
|
+
|
|
9
|
+
The costed ``plan``/``execute`` Transform pipeline (each transform delegating to
|
|
10
|
+
braidio's functional core for the actual audio, and recording provenance via
|
|
11
|
+
:mod:`braidio.provenance`) is the next increment — see the design doc and
|
|
12
|
+
nw#9 (generalizing nw's shot/mp4 render seam).
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
import nw
|
|
20
|
+
|
|
21
|
+
from braidio import bodies as _bodies # noqa: F401 (import registers schemas)
|
|
22
|
+
from braidio.kinds import WeaveKind
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Project(nw.Project):
|
|
26
|
+
"""An nw project for a braidio commentary-weave production."""
|
|
27
|
+
|
|
28
|
+
KIND: WeaveKind = WeaveKind.COMMENTARY_WEAVE
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def create_project_at(
|
|
32
|
+
projects_dir: "str | Path", project_id: str, *, title: str = "", force: bool = False
|
|
33
|
+
) -> Project:
|
|
34
|
+
"""Create a braidio project at ``projects_dir/<project_id>`` — the *host-placed* create.
|
|
35
|
+
|
|
36
|
+
The counterpart to :meth:`braidio.mcp.workspace.Workspace.create_project`, which
|
|
37
|
+
places a project in braidio's own per-caller workspace. This one takes the
|
|
38
|
+
directory from its caller, because a host that will **serve** the project
|
|
39
|
+
(reelee, over HTTP) has to put it where its own resolver and lister look — under
|
|
40
|
+
braidio's data home it would be a sibling of nothing the host can address. See
|
|
41
|
+
nw's ``projects_dir`` placement contract (thorwhalen/nw#84).
|
|
42
|
+
|
|
43
|
+
Deliberately here and not in ``braidio.mcp.workspace``: importing that module
|
|
44
|
+
runs ``braidio/mcp/__init__.py`` and pulls **fastmcp**, and the host-placed path
|
|
45
|
+
has no reason to require the MCP extra. ``project_id`` is validated as a single
|
|
46
|
+
traversal-safe component, so the result is always a direct child of
|
|
47
|
+
``projects_dir`` — which is the property the host's lister depends on, and which
|
|
48
|
+
nw verifies after the fact.
|
|
49
|
+
|
|
50
|
+
>>> import tempfile
|
|
51
|
+
>>> with tempfile.TemporaryDirectory() as d:
|
|
52
|
+
... p = create_project_at(d, "ep_01", title="Episode 1")
|
|
53
|
+
... p.root.name
|
|
54
|
+
'ep_01'
|
|
55
|
+
"""
|
|
56
|
+
from braidio._paths import safe_component
|
|
57
|
+
|
|
58
|
+
root = Path(projects_dir) / safe_component(project_id, label="project_id")
|
|
59
|
+
root.parent.mkdir(parents=True, exist_ok=True)
|
|
60
|
+
return Project.init(root, title=title or project_id, force=force)
|
|
@@ -686,47 +686,6 @@ def test_create_and_list_projects():
|
|
|
686
686
|
assert row["modified"] is not None and row["created"] is None
|
|
687
687
|
|
|
688
688
|
|
|
689
|
-
@_NW
|
|
690
|
-
def test_project_status_serves_the_genre_status_plus_full_episodes(
|
|
691
|
-
monkeypatch, tmp_path
|
|
692
|
-
):
|
|
693
|
-
from braidio.mcp.tools import _workspace
|
|
694
|
-
|
|
695
|
-
server = _local_server(ledger={})
|
|
696
|
-
_call(server, "create_project", {"project_id": "demo", "title": "Demo"})
|
|
697
|
-
empty = _call(server, "project_status", {"project_id": "demo"}).structured_content
|
|
698
|
-
assert empty["next_step"]["op"] == "save_script" and empty["episodes"] == []
|
|
699
|
-
|
|
700
|
-
# weave one episode with the audio boundaries stubbed (no synthesis, no ffmpeg)
|
|
701
|
-
def _write(out, tag=b"A"):
|
|
702
|
-
Path(out).parent.mkdir(parents=True, exist_ok=True)
|
|
703
|
-
Path(out).write_bytes(tag)
|
|
704
|
-
return Path(out)
|
|
705
|
-
|
|
706
|
-
monkeypatch.setattr(
|
|
707
|
-
braidio,
|
|
708
|
-
"narrate",
|
|
709
|
-
lambda text, out, *, return_cache_status=False, **kw: (
|
|
710
|
-
(_write(out), False) if return_cache_status else _write(out)
|
|
711
|
-
),
|
|
712
|
-
)
|
|
713
|
-
monkeypatch.setattr(braidio, "weave_timeline", lambda items, out, **kw: _write(out))
|
|
714
|
-
monkeypatch.setattr(braidio, "duration_s", lambda path: 3.0)
|
|
715
|
-
proj = Workspace.for_email(OWNER).open_project("demo")
|
|
716
|
-
script = braidio.Script(
|
|
717
|
-
title="Demo", id_slug="demo", beats=[braidio.Narration(text="Hello.")]
|
|
718
|
-
)
|
|
719
|
-
episode = braidio.weave_project(proj, script)
|
|
720
|
-
|
|
721
|
-
out = _call(server, "project_status", {"project_id": "demo"}).structured_content
|
|
722
|
-
assert out["project_id"] == "demo" and out["episode_count"] == 1
|
|
723
|
-
assert out["latest_episode"]["episode_id"] == str(episode.id)
|
|
724
|
-
# the tool, unlike the path-free genre status, returns each full body
|
|
725
|
-
(row,) = out["episodes"]
|
|
726
|
-
assert row["episode_id"] == str(episode.id)
|
|
727
|
-
assert row["url"].startswith("file://")
|
|
728
|
-
|
|
729
|
-
|
|
730
689
|
@_NW
|
|
731
690
|
def test_weave_project_records_cost(monkeypatch):
|
|
732
691
|
server = _local_server(ledger={})
|
|
@@ -1196,56 +1196,3 @@ def test_an_episode_woven_before_the_declaration_is_reused_not_re_rendered(
|
|
|
1196
1196
|
assert [a.id for a in nw.annotations_at_tier(project.root, "episode-renders")] == [
|
|
1197
1197
|
before.id
|
|
1198
1198
|
]
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
# --- genre_status: the commentary status a host's project_status serves (braidio#125)
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
def test_genre_status_follows_the_project_from_empty_to_woven(
|
|
1205
|
-
project, script_and_source, patched_synthesis
|
|
1206
|
-
):
|
|
1207
|
-
import nw
|
|
1208
|
-
|
|
1209
|
-
from braidio.project import NEXT_STEP_DONE, NEXT_STEP_SAVE_SCRIPT, NEXT_STEP_WEAVE
|
|
1210
|
-
|
|
1211
|
-
def op(status):
|
|
1212
|
-
return status["next_step"]["op"], status["next_step"]["why"]
|
|
1213
|
-
|
|
1214
|
-
fresh = project.genre_status()
|
|
1215
|
-
assert fresh["episode_count"] == 0 and fresh["latest_episode"] is None
|
|
1216
|
-
assert op(fresh) == NEXT_STEP_SAVE_SCRIPT
|
|
1217
|
-
assert fresh["narration_beats"] == fresh["clips"] == 0
|
|
1218
|
-
|
|
1219
|
-
script, source = script_and_source
|
|
1220
|
-
braidio.transforms.ingest_script(project, script, source=source)
|
|
1221
|
-
saved = project.genre_status()
|
|
1222
|
-
assert (saved["narration_beats"], saved["clips"]) == (2, 1)
|
|
1223
|
-
assert op(saved) == NEXT_STEP_WEAVE
|
|
1224
|
-
|
|
1225
|
-
first = braidio.weave_project(project, script, source=source)
|
|
1226
|
-
changed = braidio.Script(
|
|
1227
|
-
title=script.title,
|
|
1228
|
-
id_slug=script.id_slug,
|
|
1229
|
-
beats=[*script.beats[:2], braidio.Narration(text="A different ending.")],
|
|
1230
|
-
)
|
|
1231
|
-
second = braidio.weave_project(project, changed, source=source)
|
|
1232
|
-
# an in-place rewrite moves the older episode to the end of the store's
|
|
1233
|
-
# order: "latest" must come from generation time, not from that order
|
|
1234
|
-
with nw.open_project_stores(project.root) as stores:
|
|
1235
|
-
for store in stores:
|
|
1236
|
-
if store.remove(first.id) is not None:
|
|
1237
|
-
break
|
|
1238
|
-
project.graph.add_annotation(first) # same node, same generation time
|
|
1239
|
-
woven = project.genre_status()
|
|
1240
|
-
# a re-weave adds an episode: the status counts them and names the newest
|
|
1241
|
-
assert woven["episode_count"] == 2
|
|
1242
|
-
assert woven["latest_episode"] == {
|
|
1243
|
-
"episode_id": str(second.id),
|
|
1244
|
-
"profile": "personal",
|
|
1245
|
-
"duration_s": 2.0,
|
|
1246
|
-
}
|
|
1247
|
-
assert op(woven) == NEXT_STEP_DONE
|
|
1248
|
-
# what a host serves: nw's guard passes it through unchanged (JSON, small,
|
|
1249
|
-
# and no string naming the project root — the episode's file:// url is left out)
|
|
1250
|
-
assert nw.genre_status_of(project) == woven
|
|
1251
|
-
assert str(project.root) not in repr(woven)
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"""braidio as an nw app: a :class:`nw.Project` for commentary-weave productions.
|
|
2
|
-
|
|
3
|
-
Subclassing ``nw.Project`` inherits the whole folder facade + lacing graph +
|
|
4
|
-
freshness (``stale_after``) machinery; braidio adds its production kind and its
|
|
5
|
-
domain/render body-schema vocabulary (registered on import of
|
|
6
|
-
:mod:`braidio.bodies`). This module requires ``nw``; it is imported lazily by
|
|
7
|
-
``braidio/__init__`` only when ``nw`` is available.
|
|
8
|
-
|
|
9
|
-
The costed ``plan``/``execute`` Transform pipeline (each transform delegating to
|
|
10
|
-
braidio's functional core for the actual audio, and recording provenance via
|
|
11
|
-
:mod:`braidio.provenance`) is the next increment — see the design doc and
|
|
12
|
-
nw#9 (generalizing nw's shot/mp4 render seam).
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
from pathlib import Path
|
|
18
|
-
|
|
19
|
-
import nw
|
|
20
|
-
|
|
21
|
-
from braidio import bodies as _bodies # noqa: F401 (import registers schemas)
|
|
22
|
-
from braidio.kinds import WeaveKind
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
#: The next step, by how far the project has got: ``(op, why)``, ``op`` in
|
|
26
|
-
#: braidio's own vocabulary (a host maps it to its tool name, prefix and all).
|
|
27
|
-
NEXT_STEP_SAVE_SCRIPT = ("save_script", "there is no script yet")
|
|
28
|
-
NEXT_STEP_WEAVE = ("weave_project", "the script has not been rendered yet")
|
|
29
|
-
NEXT_STEP_DONE = (
|
|
30
|
-
"weave_project",
|
|
31
|
-
"an episode is made — download it by its episode_id, or weave again after "
|
|
32
|
-
"changing the script",
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def _tiers():
|
|
37
|
-
"""The tier names, from the one table the transforms write by (lazy: the
|
|
38
|
-
transforms package is heavy and this module is imported with ``braidio``)."""
|
|
39
|
-
from braidio.transforms import _common
|
|
40
|
-
|
|
41
|
-
return _common
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def _episode_row(annotation) -> dict:
|
|
45
|
-
"""One finished episode, path-free: the body's ``file://`` url and its
|
|
46
|
-
(large) timeline are left out."""
|
|
47
|
-
body = annotation.body
|
|
48
|
-
duration = body.get("duration_s")
|
|
49
|
-
return {
|
|
50
|
-
"episode_id": str(annotation.id),
|
|
51
|
-
"profile": body.get("profile"),
|
|
52
|
-
"duration_s": None if duration is None else round(float(duration), 2),
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class Project(nw.Project):
|
|
57
|
-
"""An nw project for a braidio commentary-weave production."""
|
|
58
|
-
|
|
59
|
-
KIND: WeaveKind = WeaveKind.COMMENTARY_WEAVE
|
|
60
|
-
|
|
61
|
-
def episodes(self) -> list:
|
|
62
|
-
"""The project's finished episodes (``episode-renders`` nodes), oldest first.
|
|
63
|
-
|
|
64
|
-
A re-weave adds an episode and keeps the earlier ones, so the last is
|
|
65
|
-
the current one.
|
|
66
|
-
"""
|
|
67
|
-
tiers = _tiers()
|
|
68
|
-
return sorted(
|
|
69
|
-
nw.annotations_at_tier(self.root, tiers.TIER_EPISODE_RENDER),
|
|
70
|
-
# generation time, then id: nw's own order (ties: legacy tick-0 stamps)
|
|
71
|
-
key=lambda a: (a.provenance.generated_at_time.to_seconds(), str(a.id)),
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
def genre_status(self) -> dict:
|
|
75
|
-
"""Where this production stands, for a host's one ``project_status`` door
|
|
76
|
-
(``nw.Project.genre_status``, nw#133; braidio#125).
|
|
77
|
-
|
|
78
|
-
Counted, in muvid's shape: the script's beats by kind, how many episodes
|
|
79
|
-
were rendered, the latest one (path-free), and the next step as
|
|
80
|
-
``{"op", "why"}``. Indexed tier reads only — no freshness walk, no file
|
|
81
|
-
probe — and no per-item list, so it stays small however often the
|
|
82
|
-
project is re-woven, and never names a path.
|
|
83
|
-
|
|
84
|
-
>>> import tempfile
|
|
85
|
-
>>> with tempfile.TemporaryDirectory() as d:
|
|
86
|
-
... status = create_project_at(d, "ep").genre_status()
|
|
87
|
-
>>> status["episode_count"], status["next_step"]["op"]
|
|
88
|
-
(0, 'save_script')
|
|
89
|
-
"""
|
|
90
|
-
tiers = _tiers()
|
|
91
|
-
counts = {
|
|
92
|
-
key: len(nw.annotations_at_tier(self.root, tier))
|
|
93
|
-
for key, tier in (
|
|
94
|
-
("narration_beats", tiers.TIER_NARRATIVE_BEAT),
|
|
95
|
-
("dialogue_beats", tiers.TIER_DIALOGUE_BEAT),
|
|
96
|
-
("clips", tiers.TIER_AUDIO_CLIP),
|
|
97
|
-
("scene_breaks", tiers.TIER_SCENE_BREAK),
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
episodes = self.episodes()
|
|
101
|
-
if episodes:
|
|
102
|
-
op, why = NEXT_STEP_DONE
|
|
103
|
-
elif any(counts.values()):
|
|
104
|
-
op, why = NEXT_STEP_WEAVE
|
|
105
|
-
else:
|
|
106
|
-
op, why = NEXT_STEP_SAVE_SCRIPT
|
|
107
|
-
return {
|
|
108
|
-
**counts,
|
|
109
|
-
"episode_count": len(episodes),
|
|
110
|
-
"latest_episode": _episode_row(episodes[-1]) if episodes else None,
|
|
111
|
-
"next_step": {"op": op, "why": why},
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def create_project_at(
|
|
116
|
-
projects_dir: "str | Path", project_id: str, *, title: str = "", force: bool = False
|
|
117
|
-
) -> Project:
|
|
118
|
-
"""Create a braidio project at ``projects_dir/<project_id>`` — the *host-placed* create.
|
|
119
|
-
|
|
120
|
-
The counterpart to :meth:`braidio.mcp.workspace.Workspace.create_project`, which
|
|
121
|
-
places a project in braidio's own per-caller workspace. This one takes the
|
|
122
|
-
directory from its caller, because a host that will **serve** the project
|
|
123
|
-
(reelee, over HTTP) has to put it where its own resolver and lister look — under
|
|
124
|
-
braidio's data home it would be a sibling of nothing the host can address. See
|
|
125
|
-
nw's ``projects_dir`` placement contract (thorwhalen/nw#84).
|
|
126
|
-
|
|
127
|
-
Deliberately here and not in ``braidio.mcp.workspace``: importing that module
|
|
128
|
-
runs ``braidio/mcp/__init__.py`` and pulls **fastmcp**, and the host-placed path
|
|
129
|
-
has no reason to require the MCP extra. ``project_id`` is validated as a single
|
|
130
|
-
traversal-safe component, so the result is always a direct child of
|
|
131
|
-
``projects_dir`` — which is the property the host's lister depends on, and which
|
|
132
|
-
nw verifies after the fact.
|
|
133
|
-
|
|
134
|
-
>>> import tempfile
|
|
135
|
-
>>> with tempfile.TemporaryDirectory() as d:
|
|
136
|
-
... p = create_project_at(d, "ep_01", title="Episode 1")
|
|
137
|
-
... p.root.name
|
|
138
|
-
'ep_01'
|
|
139
|
-
"""
|
|
140
|
-
from braidio._paths import safe_component
|
|
141
|
-
|
|
142
|
-
root = Path(projects_dir) / safe_component(project_id, label="project_id")
|
|
143
|
-
root.parent.mkdir(parents=True, exist_ok=True)
|
|
144
|
-
return Project.init(root, title=title or project_id, force=force)
|
|
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.78 → braidio-0.0.80}/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
|