Merge pull request #72 from tuliovianna-lab/feat/clip-editor-ux

Clip editor: source monitor, three-point editing, and a timeline that works while edited
This commit is contained in:
mutonby 2026-08-20 12:33:28 +01:00 committed by GitHub
commit 05f13254e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 937 additions and 210 deletions

11
app.py
View file

@ -2224,9 +2224,10 @@ async def get_clip_transcript(job_id: str, clip_index: int, request: Request):
# --- Clip editor: EDL + re-render ---
# How much transcript to send around the clip's segments — enough for the
# editor's word-level trimming without shipping a whole podcast's words.
EDL_WORD_CONTEXT_SECONDS = 45.0
# The editor ships the WHOLE source transcript, not a window around the clip:
# the point of the source track is extending a cut into material the clip never
# covered, and you cannot pick a new in-point from words you were not sent.
# Cost is about 7 KB of JSON per minute of speech, fetched once per editor open.
def _source_duration_seconds(path):
@ -2295,11 +2296,9 @@ async def get_clip_edl(job_id: str, clip_index: int, request: Request):
candidates.append(words[-1]['e'])
source_duration = round(max(candidates), 3)
lo = min(s['start'] for s in segments) - EDL_WORD_CONTEXT_SECONDS
hi = max(s['end'] for s in segments) + EDL_WORD_CONTEXT_SECONDS
words_out = [
{"w": w["w"], "s": round(w["s"], 3), "e": round(w["e"], 3)}
for w in words if w["e"] >= lo and w["s"] <= hi
for w in words
]
current_file = (clip.get('video_url') or '').split('/')[-1]

File diff suppressed because it is too large Load diff

View file

@ -114,7 +114,8 @@ class TestGetEdl:
assert data["has_captions"] is False
assert data["source"]["available"] is True
assert data["source"]["url"] == f"/api/source/{JOB_ID}"
# All three transcript words sit within the ±context window.
# The editor gets the whole source transcript, not a window around
# the clip: a cut can only be extended into words it was sent.
assert [w["w"] for w in data["words"]] == ["hello", "world", "again"]
assert data["limits"]["max_segments"] == recut.MAX_SEGMENTS
# Self-host meters nothing.