Update to AI Producer by OpusClip
Snapshot Nov 24, 2026 · 12:11 UTC · version 1.2.17
Package or technical metadata updated
Package or technical metadata updated
Observed in package metadata. These changes alone do not establish a new customer-facing feature.
Up to 3 plugins free · no card required.
All fields and original values.
These are saved file metadata. Open a changed file to read its text edits.
Package file
Nov 18, 2026 · 12:14 UTC
b35ae9895f02ffa0080593a025d4c5d18b8e3dd99c9324f8a031719649ee5b64
Nov 24, 2026 · 12:11 UTC
1d76f039eb81520837cac1cb8f54e69f853ff03943635ad82a44288761ce874e
Package file
Nov 18, 2026 · 12:14 UTC
205ca58047a02fb4b06778d001aa9c1f6f2d04160d69b2706d8f7cb9aaa0c850
Nov 24, 2026 · 12:11 UTC
62cedbbc9cca946411a0f7f506bb1b33f07cee225228a106efd0a2ab6a147f30
Package file
Nov 18, 2026 · 12:14 UTC
14934
Nov 24, 2026 · 12:11 UTC
15979
Package file
Nov 18, 2026 · 12:14 UTC
e87f5de92fdb956bc3b4ab7b31085e885872f79f2471974972306060c566763d
Nov 24, 2026 · 12:11 UTC
204bfbfe1b1321968cbf20f73448b7fedb6b8f45859fd6702d8e3a6c9369cab2
Compare saved observations
Download comparison JSONChanged files
Choose a file to see its text changes. Binary or large files show metadata only.
skills/aip-composition/SKILL.md →
skills/aip-composition/references/motion-recipes.md →
skills/aip-dynamic-caption/SKILL.md →
skills/aip-reference-style/SKILL.md →
skills/aip-reference-style/references/graphics-rules.md →
skills/aip-reference-style/references/preset-hook.md →
skills/aip-reference-style/references/style-pack.md →
skills/aip-reference-style/references/tools.md →
skills/aip/references/aesthetic-rules.md →
skills/aip/references/environment.md →
skills/aip/references/host.md →
skills/aip/references/legacy-aip-line.md →
skills/aip/references/multi-video-start.md →
skills/aip/references/new-project.md →
skills/aip/references/publish.md →
skills/aip/references/supplied-broll.md →
skills/aip/references/supporting-visuals.md →
skills/aip/scripts/caption_cues.py →
skills/aip/scripts/editing_script_sync.py →
skills/aip/scripts/preflight.py →
skills/aip/scripts/editing_script_sync.py
− removed · + added
--- before +++ after @@ -1,8 +1,14 @@ #!/usr/bin/env python3 -"""Synchronize a fetched EditingScript with a single-source speaker cut, offline. +"""Synchronize a fetched EditingScript with the speaker cut in index.html, offline. Only the AV and caption projections change. Unsupported media clocks or a mounted caption renderer that would need rebaking are refused before any file is written. + +A project cut from several videos (a valid `sources` list of two or more) is synced +file by file: each speaker clip's file is the video its `src` names, every bound and +order rule holds within that file, each AV clip records its file as `sourceId`, and a +caption word is placed only on its own file's clips. Seconds of two files never compare. +A single-video document is synced exactly as before. """ import argparse @@ -25,6 +31,11 @@ TIMES = ("srcStart", "srcEnd", "timelineIn", "timelineOut") MAX_WORKSPACE_TEXT_BYTES = 32 * 1024 * 1024 TIMING_TOLERANCE_MS = Decimal("1") +# A source video's proxy is `<stem>.mp4` and its full-res file of record `<stem>_full.mp4`; +# its recorded voice is `<stem>.mp3` (the service's `source_media_stem` and `span_media_paths`). +SOURCE_VIDEO_EXTENSION = ".mp4" +FULL_RES_SUFFIX = "_full" +VOICE_EXTENSION = ".mp3" def _require(condition, code): @@ -69,11 +80,108 @@ return _round_milliseconds(_decimal_milliseconds(value)) +def _source_path(value): + """A media path as a whole, without a query, fragment, or leading `./` or `/`.""" + if not isinstance(value, str): + return "" + path = re.split(r"[?#]", value.strip(), maxsplit=1)[0] + while path.startswith("./"): + path = path[2:] + return path.lstrip("/") + + +def _source_stem(value): + """The stem a source video path shares with its other variant, or "" for a non-video.""" + path = _source_path(value) + if not path.endswith(SOURCE_VIDEO_EXTENSION): + return "" + stem = path[:-len(SOURCE_VIDEO_EXTENSION)] + return stem[:-len(FULL_RES_SUFFIX)] if stem.endswith(FULL_RES_SUFFIX) else stem + + +def _integral_ms(value): + return (isinstance(value, (int, float)) and not isinstance(value, bool) + and math.isfinite(value) and value == int(value)) + + +def _sources(doc): + """The `sources` list of a project cut from several videos, or None. + + None for a document with no list, an invalid one, or one naming a single video: the + service reads an invalid list as no list, and such a document syncs as one video, + exactly as before. + """ + value = doc.get("sources") if isinstance(doc, dict) else None + if not isinstance(value, list) or len(value) < 2: + return None + ids = set() + for entry in value: + if not (isinstance(entry, dict) and set(entry) == {"id", "path", "duration"} + and isinstance(entry["id"], str) and entry["id"] and isinstance(entry["path"], str) + and _integral_ms(entry["duration"]) and entry["id"] not in ids): + return None + ids.add(entry["id"]) + return value + + +def _video_file(path, sources): + """The id of the video a speaker video clip's `src` is a file of, matched by stem.""" + stem = _source_stem(path) + matches = [entry["id"] for entry in sources if stem and _source_stem(entry["path"]) == stem] + _require(len(matches) == 1, "editing_script_clip_file_unplaced") + return matches[0] + + +def _voice_file(path, sources): + """The id of the video whose recorded voice a speaker audio clip plays: the project's + first video's `public/source.mp3` (or its isolated swap), else `<stem>.mp3` beside a + later video's file.""" + if path in RAW_AUDIO: + return sources[0]["id"] + _require(path.endswith(VOICE_EXTENSION), "editing_script_clip_file_unplaced") + return _video_file(path[:-len(VOICE_EXTENSION)] + SOURCE_VIDEO_EXTENSION, sources) + + +def _own_video_uri(uri, file, sources): + """Whether an AV clip's `sourceUri` is a file of its own video: that video's listed path or + the full-res file beside it, by the same stem rule. Another video's file, or any voice, is + not: readers take an AV clip's `sourceUri` as the picture it plays.""" + stem = _source_stem(_local_path(uri)) + own = next(entry for entry in sources if entry["id"] == file) + return bool(stem) and stem == _source_stem(own["path"]) + + +def _source_duration(file, sources): + return Decimal(int(next(entry["duration"] for entry in sources if entry["id"] == file))) + + +def _media_paths(sources): + """Every media path a multi-source document may name: each video and its voice.""" + paths = set(RAW_AUDIO) + for entry in sources: + path = _source_path(entry["path"]) + paths.add(path) + if path.endswith(SOURCE_VIDEO_EXTENSION): + paths.add(path[:-len(SOURCE_VIDEO_EXTENSION)] + VOICE_EXTENSION) + return paths + + +# Elements HTML never closes, so they never enclose a later element. +VOID_TAGS = frozenset({"area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", + "source", "track", "wbr"}) +# The editor's soft delete: the element stays in the page, hidden, and plays nothing. +DELETED_ATTR = "data-aip-deleted" + + class _Document(HTMLParser): def __init__(self): super().__init__() self.elements = [] self.templates = 0 + # Open elements as (tag, is_stage, is_host), so a video knows whether it sits under + # #stage and whether a visual host or a composition owns it, or a deleted element holds it. + self.open = [] + self.root_videos = [] def handle_starttag(self, tag, attrs): keys = [key for key, _ in attrs] @@ -81,7 +189,23 @@ if tag == "template": self.templates += 1 if not self.templates: - self.elements.append((tag, dict(attrs))) + attrs = dict(attrs) + self.elements.append((tag, attrs)) + if tag == "video" and self._in_stage_outside_hosts(): + self.root_videos.append(attrs) + if tag not in VOID_TAGS: + attrs = dict(attrs) + self.open.append((tag, attrs.get("id") == "stage", + "visual-host" in (attrs.get("class") or "").split() + or "data-composition-src" in attrs or DELETED_ATTR in attrs)) + + def _in_stage_outside_hosts(self): + for _, is_stage, is_host in reversed(self.open): + if is_stage: + return True + if is_host: + return False + return False def handle_startendtag(self, tag, attrs): self.handle_starttag(tag, attrs) @@ -90,6 +214,10 @@ def handle_endtag(self, tag): if tag == "template": self.templates = max(0, self.templates - 1) + for position in range(len(self.open) - 1, -1, -1): + if self.open[position][0] == tag: + del self.open[position:] + break def _timing(attrs, single): @@ -107,7 +235,7 @@ return start, source, duration -def _speaker_cut(html, source): +def _speaker_cut(html, source, sources=None): _require(not re.search(r"\.playbackRate\s*=", html), "editing_script_unsupported_speed") document = _Document() document.feed(html) @@ -120,59 +248,108 @@ "editing_script_invalid_stage") total = _decimal_milliseconds(stage.get("data-duration")) video_path = _local_path(source["path"]) - lanes = {} + lanes, files = {}, {} for tag in ("video", "audio"): key = "speaker" if tag == "video" else "speaker-audio" candidates = [attrs for item_tag, attrs in elements if item_tag == tag and (attrs.get("id") == key - or "speaker-clip" in attrs.get("class", "").split())] + or "speaker-clip" in (attrs.get("class") or "").split())] _require(bool(candidates), "editing_script_missing_speaker_lane") _require(candidates[0].get("id") == key, "editing_script_speaker_order") ids = [attrs.get("id") for attrs in candidates] _require(all(ids) and len(set(ids)) == len(ids), "editing_script_duplicate_speaker_id") single = len(candidates) == 1 and "speaker-clip" not in candidates[0].get("class", "").split() - lane = [] + lane, lane_files = [], [] for attrs in candidates: - _require(single or "speaker-clip" in attrs.get("class", "").split(), + _require(single or "speaker-clip" in (attrs.get("class") or "").split(), "editing_script_ambiguous_speaker_lane") path = _local_path(attrs.get("src")) - _require(path == video_path if tag == "video" else path in RAW_AUDIO, - "editing_script_unsupported_source") + if sources is None: + _require(path == video_path if tag == "video" else path in RAW_AUDIO, + "editing_script_unsupported_source") + else: + lane_files.append(_video_file(path, sources) if tag == "video" else _voice_file(path, sources)) identifier = attrs.get("data-hf-id") or ("clip-0" if single else None) _require(isinstance(identifier, str) and bool(identifier), "editing_script_missing_clip_id") lane.append((identifier,) + _timing(attrs, single)) _require(len({row[0] for row in lane}) == len(lane), "editing_script_duplicate_clip_id") lanes[tag] = lane + files[tag] = lane_files _require(len(lanes["video"]) == len(lanes["audio"]), "editing_script_av_lane_mismatch") for video, audio in zip(lanes["video"], lanes["audio"]): _require(video[0] == audio[0] and all(abs(a - b) <= TIMING_TOLERANCE_MS for a, b in zip(video[1:], audio[1:])), "editing_script_av_lane_mismatch") - cursor, raw_cursor, previous_source_end = 0, Decimal(0), Decimal(0) + if sources is not None: + # A clip's voice is its picture's file: one video's sound under another's picture + # would be cut on the wrong clock. + _require(files["video"] == files["audio"], "editing_script_audio_other_file") + cursor, raw_cursor = 0, Decimal(0) + # Order and bounds hold within each file; on one video there is one file, `None`. + previous_source_end = {} clips = [] - for identifier, start, source_start, duration in lanes["video"]: + for position, (identifier, start, source_start, duration) in enumerate(lanes["video"]): + file = None if sources is None else files["video"][position] + limit = source["duration"] if sources is None else _source_duration(file, sources) _require(abs(start - raw_cursor) <= TIMING_TOLERANCE_MS, "editing_script_noncontiguous_output") - _require(source_start + TIMING_TOLERANCE_MS >= previous_source_end, + _require(source_start + TIMING_TOLERANCE_MS >= previous_source_end.get(file, Decimal(0)), "editing_script_unsupported_source_order") - if source["duration"] is not None: - _require(source_start + duration <= source["duration"] + TIMING_TOLERANCE_MS, + if limit is not None: + _require(source_start + duration <= limit + TIMING_TOLERANCE_MS, "editing_script_source_out_of_bounds") source_ms, duration_ms = _round_milliseconds(source_start), _round_milliseconds(duration) _require(duration_ms > 0, "editing_script_invalid_timing") # Validate raw boundaries before rounding. The service rounds each clip's # duration, then tiles those integer durations; fractional-frame cuts can # otherwise accumulate a false gap when comparing rounded DOM starts. - clips.append({"id": identifier, "srcStart": source_ms, "srcEnd": source_ms + duration_ms, - "timelineIn": cursor, "timelineOut": cursor + duration_ms}) + clip = {"id": identifier} + if file is not None: + clip["sourceId"] = file + clip.update({"srcStart": source_ms, "srcEnd": source_ms + duration_ms, + "timelineIn": cursor, "timelineOut": cursor + duration_ms}) + clips.append(clip) cursor += duration_ms raw_cursor += duration - previous_source_end = source_start + duration - _require(abs(raw_cursor - total) <= TIMING_TOLERANCE_MS and total > 0, + previous_source_end[file] = source_start + duration + speaker_sources = {attrs.get("src") for tag, attrs in elements if tag == "video" + and (attrs.get("id") == "speaker" or "speaker-clip" in (attrs.get("class") or "").split())} + # A stage longer than the voice is the length only when footage appended after the voice + # runs to it, which is when the export plays that far. + extended = (total > raw_cursor + TIMING_TOLERANCE_MS + and _appended_footage_end(document.root_videos, speaker_sources) + TIMING_TOLERANCE_MS >= total) + _require((abs(raw_cursor - total) <= TIMING_TOLERANCE_MS or extended) and total > 0, "editing_script_duration_mismatch") return clips, elements +def _is_recording_file(src): + """Source #1's files sit directly in public/ (source.mp4, source_full.mp4, source_speaker1.mp4, + ...). A later video's sit in public/sources/ and are footage like any other clip's file.""" + return src.startswith("public/source") and not src.startswith("public/sources/") + + +def _appended_footage_end(root_videos, speaker_sources): + """The end of the last root footage clip, or 0: the service's appended-footage rule + (a timed `<video class="clip">` under #stage, in no visual host or composition, that is + neither the speaker nor source #1's recording, carries no `data-hf-id`, and was not deleted + in the editor).""" + end = Decimal(0) + for attrs in root_videos: + src = (attrs.get("src") or "").strip() + if ("clip" not in (attrs.get("class") or "").split() or "data-hf-id" in attrs + or DELETED_ATTR in attrs or not src or src in speaker_sources or _is_recording_file(src)): + continue + try: + start = _decimal_milliseconds(attrs.get("data-start")) + duration = _decimal_milliseconds(attrs.get("data-duration")) + except ValueError: + continue + if start >= 0 and duration > 0: + end = max(end, start + duration) + return end + + def _source_clock(doc): if "source" not in doc: # Legacy caption-only wrappers omit the optional source header. The @@ -191,6 +368,13 @@ and _integer(doc.get("rev")) and doc["rev"] >= 0, "editing_script_invalid_document") source = _source_clock(doc) + sources = _sources(doc) + # The media a caption word may name: the one source's clock, or on a project cut from + # several videos each video and its voice. An AV clip's `sourceUri` is its picture, so on + # several videos it must be its own video's file (`_own_video_uri`). + av_media = {_local_path(source["path"])} + word_media = RAW_AUDIO | (av_media if sources is None else _media_paths(sources)) + files = None if sources is None else {entry["id"] for entry in sources} tracks = doc.get("tracks") _require(isinstance(tracks, list) and all(isinstance(track, dict) for track in tracks), "editing_script_invalid_document") @@ -214,9 +398,13 @@ for item in track["items"]: _validate_timed(item, nullable=False) _require(item["srcEnd"] > item["srcStart"], "editing_script_invalid_document") - if item.get("sourceUri"): - _require(_local_path(item["sourceUri"]) == _local_path(source["path"]), - "editing_script_unsupported_source") + if files is not None: + _require(item.get("sourceId") in files, "editing_script_record_file_unplaced") + if item.get("sourceUri") and sources is None: + _require(_local_path(item["sourceUri"]) in av_media, "editing_script_unsupported_source") + elif item.get("sourceUri"): + _require(_own_video_uri(item["sourceUri"], item["sourceId"], sources), + "editing_script_source_uri_other_file") if track.get("type") == "captions": seen = set() for section in track["items"]: @@ -232,8 +420,10 @@ _validate_timed(word, nullable=True) _require(isinstance(word.get("text"), str), "editing_script_invalid_document") if word.get("sourceUri"): - _require(_local_path(word["sourceUri"]) in RAW_AUDIO | {_local_path(source["path"])}, + _require(_local_path(word["sourceUri"]) in word_media, "editing_script_unsupported_source") + if files is not None: + _require(word.get("sourceId") in files, "editing_script_record_file_unplaced") _require(word["id"] not in seen, "editing_script_duplicate_word_id") seen.add(word["id"]) @@ -259,8 +449,19 @@ key=lambda item: item["timelineIn"]) -def _geometry(items): - return [{key: item[key] for key in ("id",) + TIMES} for item in items] +def _geometry(items, multi): + keys = ("id", "sourceId") + TIMES if multi else ("id",) + TIMES + return [{key: item[key] for key in keys} for item in items] + + +def _file(item, multi): + """A record's file on a project cut from several videos; `None` on one video, whatever + the record carries, so a single-video document compares seconds alone, as before.""" + return item.get("sourceId") if multi else None + + +def _same_file(item, clip, multi): + return _file(item, multi) == _file(clip, multi) def _subtract(ranges, covered): @@ -278,23 +479,34 @@ return remaining -def _restore_window(item, clips): - next_clip = next((clip for clip in clips if clip["srcStart"] >= item["srcStart"]), None) - start = next_clip["timelineIn"] if next_clip else clips[-1]["timelineOut"] +def _seam(file, source_time, clips, multi): + """Where a cut-away instant of `file` lands on the output timeline: the start of the first + kept clip of that file playing source at or after it, else the end of that file's last + kept clip, else the end of the timeline. On one video every clip is the same file, so + this is the first clip after the instant, else the timeline's end.""" + own = [clip for clip in clips if _file(clip, multi) == file] + next_clip = next((clip for clip in own if clip["srcStart"] >= source_time), None) + if next_clip is not None: + return next_clip["timelineIn"] + return own[-1]["timelineOut"] if own else clips[-1]["timelineOut"] + + +def _restore_window(item, clips, multi): + start = _seam(_file(item, multi), item["srcStart"], clips, multi) return {"timelineIn": start, "timelineOut": start + item["srcEnd"] - item["srcStart"]} -def _sync_av(track, clips): +def _sync_av(track, clips, multi=False): if track is None: track = {"id": AV_TRACK_ID, "type": "av", "speakerVolume": 1, "items": []} old = _playing(track) - if _geometry(old) == clips and not track.get("ledgerAhead"): + if _geometry(old, multi) == clips and not track.get("ledgerAhead"): return deepcopy(track) updated = deepcopy(track) updated.pop("ledgerAhead", None) playable = [] for clip in clips: - prior = next((item for item in old if item["id"] == clip["id"] + prior = next((item for item in old if item["id"] == clip["id"] and _same_file(item, clip, multi) and item["srcStart"] == clip["srcStart"] and item["srcEnd"] == clip["srcEnd"]), None) value = deepcopy(prior) if prior else {} value.update(clip) @@ -304,25 +516,35 @@ carried = [] for item in track["items"]: if item.get("state") is not None and not any( - item["srcStart"] < clip["srcEnd"] and clip["srcStart"] < item["srcEnd"] for clip in clips): + _same_file(item, clip, multi) + and item["srcStart"] < clip["srcEnd"] and clip["srcStart"] < item["srcEnd"] + for clip in clips): value = deepcopy(item) - value.update(_restore_window(item, clips)) + value.update(_restore_window(item, clips, multi)) carried.append(value) removed = [] occupied = {item["id"] for item in playable + carried} - ranges = _subtract([(clip["srcStart"], clip["srcEnd"]) for clip in old], - [(clip["srcStart"], clip["srcEnd"]) for clip in clips]) - for start, end in ranges: + # Source that played before and does not now, within each file: seconds of two files + # never subtract from each other. + ranges = [] + for file in dict.fromkeys(_file(clip, multi) for clip in old): + ranges.extend((file, start, end) for start, end in _subtract( + [(clip["srcStart"], clip["srcEnd"]) for clip in old if _file(clip, multi) == file], + [(clip["srcStart"], clip["srcEnd"]) for clip in clips if _file(clip, multi) == file])) + for file, start, end in ranges: identifier = "cut-{}".format(start) suffix = 1 while identifier in occupied: identifier = "cut-{}-{}".format(start, suffix) suffix += 1 occupied.add(identifier) - item = {"id": identifier, "srcStart": start, "srcEnd": end, - "state": "deleted", "stateReason": dict(REMOVAL_REASON), - "origin": {"kind": "split", "from": "av-source"}} - item.update(_restore_window(item, clips)) + item = {"id": identifier} + if file is not None: + item["sourceId"] = file + item.update({"srcStart": start, "srcEnd": end, + "state": "deleted", "stateReason": dict(REMOVAL_REASON), + "origin": {"kind": "split", "from": "av-source"}}) + item.update(_restore_window(item, clips, multi)) removed.append(item) updated["items"] = playable + carried + removed return updated @@ -336,8 +558,21 @@ return max((clip["timelineOut"] for clip in clips if clip["srcStart"] < source_time), default=0) -def _project_segment(segment, clips): +def _segment_file(segment): + """The one file a caption segment's words name on a project cut from several videos. A + segment is phrased within one file, so one that names two cannot be placed.""" + files = {_file(word, True) for word in segment["words"]} + _require(len(files) <= 1, "editing_script_segment_spans_files") + return next(iter(files), None) + + +def _project_segment(segment, clips, multi=False): words = segment["words"] + file = _segment_file(segment) if multi else None + timeline = clips + if multi: + # A word is placed, and collapses, only on its own file's clips. + clips = [clip for clip in clips if _file(clip, True) == file] anchor = next((word for word in words if word["srcStart"] is not None and _covering(clips, word["srcStart"]) is not None), None) anchor_output = None @@ -356,7 +591,8 @@ else: clip = _covering(clips, word["srcStart"]) if clip is None: - start = end = _collapsed(clips, word["srcStart"]) + start = end = (_seam(file, word["srcStart"], timeline, True) if multi + else _collapsed(clips, word["srcStart"])) else: intersections = sum(word["srcStart"] < item["srcEnd"] and item["srcStart"] < word["srcEnd"] for item in clips) @@ -374,12 +610,14 @@ return result -def _caption_spans(clips): +def _caption_spans(clips, multi): # A speaker split alone does not cut speech. Adjacent source/output spans - # share one caption clock, including the service's millisecond rounding. + # share one caption clock, including the service's millisecond rounding, + # within one file. spans = [] for clip in clips: - if spans and abs(clip["srcStart"] - spans[-1]["srcEnd"]) <= TIMING_TOLERANCE_MS: + if (spans and _same_file(clip, spans[-1], multi) + and abs(clip["srcStart"] - spans[-1]["srcEnd"]) <= TIMING_TOLERANCE_MS): spans[-1]["srcEnd"] = clip["srcEnd"] spans[-1]["timelineOut"] = clip["timelineOut"] else: @@ -387,14 +625,47 @@ return spans -def _sync_captions(track, clips): - clips = _caption_spans(clips) +def _in_output_order(sections): + """Sections whose segments run in output order across the whole track, for a cut of + several videos. Clips of one video can play around another's (A, then B, then A again), so + a section's projected segments may sit on either side of another section's. Each section + keeps one file and its own order; one interrupted by another section's segment is split + there, the later part under a new id, so the document order is the output order and every + neighbouring window is well formed.""" + taken = {section["id"] for section in sections} + placed = sorted(((segment["timelineIn"], order, number, section, segment) + for order, section in enumerate(sections) + for number, segment in enumerate(section["segments"])), + key=lambda row: row[:3]) + result, current, parts = [], None, {} + for _, order, _, section, segment in placed: + if current is None or current[0] != order: + part = parts.get(order, 0) + parts[order] = part + 1 + identifier = section["id"] + if part: + identifier = "{}-{}".format(section["id"], part) + while identifier in taken: + identifier += "-part" + taken.add(identifier) + fresh = dict(section, id=identifier, segments=[]) + result.append(fresh) + current = (order, fresh) + current[1]["segments"].append(segment) + return result + [section for section in sections if not section["segments"]] + + +def _sync_captions(track, clips, multi=False): + clips = _caption_spans(clips, multi) updated = deepcopy(track) for section in updated["items"]: - section["segments"] = sorted((_project_segment(segment, clips) for segment in section["segments"]), + section["segments"] = sorted((_project_segment(segment, clips, multi) for segment in section["segments"]), key=lambda segment: segment["timelineIn"]) - updated["items"].sort(key=lambda section: section["segments"][0]["timelineIn"] - if section["segments"] else 0) + if multi: + updated["items"] = _in_output_order(updated["items"]) + else: + updated["items"].sort(key=lambda section: section["segments"][0]["timelineIn"] + if section["segments"] else 0) segments = [segment for section in updated["items"] for segment in section["segments"]] for index, segment in enumerate(segments): segment["timelineIn"] = segments[index - 1]["timelineOut"] if index else 0 @@ -410,7 +681,7 @@ identifier = attrs.get("data-composition-id", "") path = attrs.get("data-composition-src", "") if (identifier == "narrator-captions" or "narrator_captions" in path - or "caption-word" in attrs.get("class", "").split()): + or "caption-word" in (attrs.get("class") or "").split()): return True if re.search(r"(?:^|[-_/])captions?(?:[-_/.]|$)", identifier + "/" + path, re.I): return True @@ -426,11 +697,13 @@ A word spanning two kept intervals is ambiguous and is refused. """ _validate_document(existing_doc) - clips, elements = _speaker_cut(html, _source_clock(existing_doc)) + sources = _sources(existing_doc) + multi = sources is not None + clips, elements = _speaker_cut(html, _source_clock(existing_doc), sources) av = next((track for track in existing_doc["tracks"] if track["type"] == "av"), None) captions = next(track for track in existing_doc["tracks"] if track["type"] == "captions") - new_av = _sync_av(av, clips) - new_captions = _sync_captions(captions, clips) + new_av = _sync_av(av, clips, multi) + new_captions = _sync_captions(captions, clips, multi) old_words = [word for section in captions["items"] for segment in section["segments"] for word in segment["words"]] new_words = [word for section in new_captions["items"] for segment in section["segments"]
Full technical diff · 43 changed fields
changed /files/.codex-plugin~1plugin.json/sha256
"b35ae9895f02ffa0080593a025d4c5d18b8e3dd99c9324f8a031719649ee5b64"
"1d76f039eb81520837cac1cb8f54e69f853ff03943635ad82a44288761ce874e"
changed /files/skills~1aip-composition~1SKILL.md/sha256
"205ca58047a02fb4b06778d001aa9c1f6f2d04160d69b2706d8f7cb9aaa0c850"
"62cedbbc9cca946411a0f7f506bb1b33f07cee225228a106efd0a2ab6a147f30"
changed /files/skills~1aip-composition~1SKILL.md/size
14934
15979
changed /files/skills~1aip-composition~1references~1motion-recipes.md/sha256
"e87f5de92fdb956bc3b4ab7b31085e885872f79f2471974972306060c566763d"
"204bfbfe1b1321968cbf20f73448b7fedb6b8f45859fd6702d8e3a6c9369cab2"
changed /files/skills~1aip-composition~1references~1motion-recipes.md/size
4417
4608
changed /files/skills~1aip-dynamic-caption~1SKILL.md/sha256
"b1a9a3ace5d9ad77bfa92c6af5cd21bf2f8ae041b816e5f109f2372dcf32997a"
"21728ae37fc4ae1b18d8d502bc4345be16180367cf6e0b9e576460b2e989056c"
changed /files/skills~1aip-dynamic-caption~1SKILL.md/size
8041
9299
changed /files/skills~1aip-reference-style~1SKILL.md/sha256
"0d1ce500dd138a2cc0eb5e39f0902699c15568ba25083e3b09dc6d933a3ec7c5"
"204ec064aee31f0bd301e5de13c285daebe5e0945f55034d29da1579bdb1277a"
changed /files/skills~1aip-reference-style~1SKILL.md/size
16108
23443
added /files/skills~1aip-reference-style~1references~1graphics-rules.md
Field was absent
{
"sha256": "403c485c0676d8bf2cabcc9b28e265c409e326ddb721e5b14677d566ae05f94a",
"size": 5391
}changed /files/skills~1aip-reference-style~1references~1preset-hook.md/sha256
"be6781ec5821a6591f3f7f5da27591a7ef001783d55d09938e50302b661613c8"
"ab41935ffe062ed0479399399e4f850dc1c0f59a35d5ecae7f65b755f3c1716c"
changed /files/skills~1aip-reference-style~1references~1preset-hook.md/size
3590
4316
changed /files/skills~1aip-reference-style~1references~1style-pack.md/sha256
"66601d52fe5671e95ec374281087be6d8680f21eea0bae2c3268fe7098507a08"
"bc423f2f3e99680286e1a4be8e1e341876d52c78f096137b030fbe74f3a837b0"
changed /files/skills~1aip-reference-style~1references~1style-pack.md/size
8950
9598
changed /files/skills~1aip-reference-style~1references~1tools.md/sha256
"b76236eb6080a684af8d9c8e8fbcf85b9649db8a76007197c31b2594f4bc0e41"
"cb3a2d3f9688a7f10fbc81e2a2d2a48ac5141f0f9b226e40bf306eeec6d40d78"
changed /files/skills~1aip-reference-style~1references~1tools.md/size
3549
3669
changed /files/skills~1aip~1SKILL.md/sha256
"e5ba2af1a8a88a85528048a12ae487b54e6aa1aee81d6c00347c98d54703dafd"
"bf1a27ea4887e9be755dd2ba4cc4d59006ff98d4114027db0a5383d51533234a"
changed /files/skills~1aip~1SKILL.md/size
35044
23522
changed /files/skills~1aip~1references~1aesthetic-rules.md/sha256
"efab07b94d8f3dff020a4e3a6a45e44c35a45ba8cd5b5fbcc4b584a1201f4826"
"f79dd519a03375cbe596cdf373e3a16e365c26555a936bb7555ae39a173e1804"
changed /files/skills~1aip~1references~1aesthetic-rules.md/size
16495
18035
changed /files/skills~1aip~1references~1environment.md/sha256
"3bc7e8999bc0ef84c6c29a0ddf0b93759f4c9043b7a55d6f68832b01ea0bf52b"
"6eab74a2fe282a650ca3b1e231b3c2ab5d9eb6be553e2ac4f9f651e513c85a02"
changed /files/skills~1aip~1references~1environment.md/size
7037
7384
changed /files/skills~1aip~1references~1host.md/sha256
"cd3a051bf94c3e9fd827c48bf39c5770affe3ed70bfb35cb63862776859e9dd9"
"b488b7ce94b7f35245aaf101104d76d94c420825d373f4ca186aadccfeceb818"
changed /files/skills~1aip~1references~1host.md/size
8433
8439
changed /files/skills~1aip~1references~1legacy-aip-line.md/sha256
"b6f7c82463cbd8cc020fa94737506d73aaa65e95541876c0b779b313f1308cf2"
"0b386450acb48973da6fa0fb33694333bccc8439bc482a14811c0d69b5aa7ccf"
changed /files/skills~1aip~1references~1legacy-aip-line.md/size
996
797
changed /files/skills~1aip~1references~1multi-video-start.md/sha256
"07fbe22705541aca917b83e0b41175ee807154429063c94c7c50986c567276d5"
"fa6c601be56971df7f5ba6935060fa22332fdca711bf6b9865bda8d751dafabc"
changed /files/skills~1aip~1references~1multi-video-start.md/size
2307
5303
added /files/skills~1aip~1references~1new-project.md
Field was absent
{
"sha256": "5a3357614d17088bcea9ea16324ad7dd1347efd9f3635723daa1525c2cda61ee",
"size": 12481
}changed /files/skills~1aip~1references~1publish.md/sha256
"d223cca4ce1763159c52dfce6ed4fb60856442911d53521d21a42b7d4e2bbf44"
"c023e57ee6e28ae656a4b693fd284e9a9fb844e53c083b24806e72ffef1d7f7a"
changed /files/skills~1aip~1references~1publish.md/size
4626
5568
changed /files/skills~1aip~1references~1supplied-broll.md/sha256
"57a4d3fadcc500894b3f4a06e59c3dcd335b87b787ea0059a5f5db9bd1f534f4"
"5e93c642d3c8074a9aab836515dd443ab1c674c1605d1ddd352ae40cfbcb023f"
changed /files/skills~1aip~1references~1supplied-broll.md/size
1194
1178
added /files/skills~1aip~1references~1supporting-visuals.md
Field was absent
{
"sha256": "022aefd758fcfcf4a047a326d979c630ad66f48b958059ccf96cdde65c68b3b4",
"size": 3708
}changed /files/skills~1aip~1scripts~1caption_cues.py/sha256
"bfdb1a7478da8dbfd4254cfd38ee564fb494dc23d0cae98e92a986372614a25c"
"26137c7e5a4c83bc985ec27a398322a402a3bfd825b56ae940279780db5f6910"
changed /files/skills~1aip~1scripts~1caption_cues.py/size
6858
8033
changed /files/skills~1aip~1scripts~1editing_script_sync.py/sha256
"d642f14fb433c6a34791180e4570f196712bfc90270c50384a6d46bd87aad3f3"
"3f355e4a9e1033445b9a6f435c28fe8c40e9b4899f4a2b6d9fe0ff1db33f6096"
changed /files/skills~1aip~1scripts~1editing_script_sync.py/size
24712
38003
changed /files/skills~1aip~1scripts~1preflight.py/sha256
"117312def874fa095397f451ff28fda1757ade3aa699ca19b99da9043e423e73"
"ab4c5d1d84fd643067b405288a311b755488ae16149038984c8a6da5fa2dc982"
changed /files/skills~1aip~1scripts~1preflight.py/size
13703
15114
added /files/skills~1aip~1scripts~1source_files.py
Field was absent
{
"sha256": "e1fb77a599405e8c08342f194480ad8a29343545f7cf1a9fb1e28fdce048cc32",
"size": 12184
}changed /files/skills~1aip~1scripts~1speaker_effects.py/sha256
"58679fc9252570adf0d2df4c78afdf9c284c826662347258976b685c67171bbc"
"4684a48ddeafc3f2c46f8cdd1d4ec7377b3c05e3a5cb48966f2be819e75247b5"
changed /files/skills~1aip~1scripts~1speaker_effects.py/size
21180
22349
Full snapshot data
{
"files": {
".app.json": {
"sha256": "10674011cdffa91e9ec0f46f16b9e3da709c6f6f0c89e2f60418b3c478242fc9",
"size": 103
},
".codex-plugin/plugin.json": {
"sha256": "1d76f039eb81520837cac1cb8f54e69f853ff03943635ad82a44288761ce874e",
"size": 2078
},
".mcp.json": {
"sha256": "8616d7f632e6c9421887ba95db5d61bf8e70787f670c04cd6d69058e55717777",
"size": 124
},
"LICENSE": {
"sha256": "118c63fa5066c430a84be4ae84aa142b7c9747f0813689388fccf4c671bfd5ad",
"size": 1065
},
"THIRD_PARTY_NOTICES.md": {
"sha256": "ddbc372c0e843973e4c2d5144e26ca1e1fd1d7ae06818eea518ba3abb290401e",
"size": 2604
},
"assets/icon-dark.png": {
"sha256": "2dff2a029d55e11f003b542602f9a3e9cfdb12c027644521a0532268a1ee16c7",
"size": 25723
},
"assets/icon.png": {
"sha256": "02e5e0dc166b313ae640fc6bbc9cc22a3888ce3ec48487865d07b8264225886c",
"size": 38033
},
"licenses/Apache-2.0.txt": {
"sha256": "4259155fb06f127687ee7b0a8a3682d45132db0f2da26cbc0b7a2d1e796436b8",
"size": 10763
},
"skills/aip-composition/SKILL.md": {
"sha256": "62cedbbc9cca946411a0f7f506bb1b33f07cee225228a106efd0a2ab6a147f30",
"size": 15979
},
"skills/aip-composition/agents/openai.yaml": {
"sha256": "354889dc09758e80cb83ff52f48a62c425f7c568c55d2654f1d17115e6834297",
"size": 140
},
"skills/aip-composition/references/code-drawn.md": {
"sha256": "f5ded02554f50d2a97519cb295070ac1c1586e1b68de18097034f5a5ae428e21",
"size": 13194
},
"skills/aip-composition/references/motion-recipes.md": {
"sha256": "204bfbfe1b1321968cbf20f73448b7fedb6b8f45859fd6702d8e3a6c9369cab2",
"size": 4608
},
"skills/aip-composition/references/pip-transition.md": {
"sha256": "caac1c02405c502c94d2c2f69e0c30c1c77b8ba1d34ec732506c2728cf1c9297",
"size": 2578
},
"skills/aip-dynamic-caption/SKILL.md": {
"sha256": "21728ae37fc4ae1b18d8d502bc4345be16180367cf6e0b9e576460b2e989056c",
"size": 9299
},
"skills/aip-dynamic-caption/agents/openai.yaml": {
"sha256": "2518d70cef8280feb74ca81d89f61ddc5df4b22e15aebfdc815aa4369dd1142f",
"size": 137
},
"skills/aip-dynamic-caption/references/service-captions.md": {
"sha256": "760f7339892e205bfff9c0c8ab0b128a97c29d7486b078d621254bade80a876f",
"size": 1092
},
"skills/aip-dynamic-caption/references/writing-captions.md": {
"sha256": "13f7db7dc8abf17d81c66c6176684030a74da66693db1c45dfa7c95af49b721b",
"size": 757
},
"skills/aip-framing/SKILL.md": {
"sha256": "6c397177b2847b92bbe52e0a2a65a80a24fcc5227befa9a91722be7359209bc9",
"size": 21116
},
"skills/aip-framing/agents/openai.yaml": {
"sha256": "4973b17f06f4cc97c8e2e827fa79b7ac577b3fa08ae012d412f55e061f8d8374",
"size": 167
},
"skills/aip-framing/references/cutout.md": {
"sha256": "9a07a700e4de729700b8c50c640f25d1fef2de830024e9357038a32c894e2102",
"size": 4995
},
"skills/aip-reference-style/SKILL.md": {
"sha256": "204ec064aee31f0bd301e5de13c285daebe5e0945f55034d29da1579bdb1277a",
"size": 23443
},
"skills/aip-reference-style/agents/openai.yaml": {
"sha256": "a0dc40c50f4a49aea248c9f5142fd4d82576247125c10be0525abf8815c13885",
"size": 133
},
"skills/aip-reference-style/references/graphics-rules.md": {
"sha256": "403c485c0676d8bf2cabcc9b28e265c409e326ddb721e5b14677d566ae05f94a",
"size": 5391
},
"skills/aip-reference-style/references/preset-hook.md": {
"sha256": "ab41935ffe062ed0479399399e4f850dc1c0f59a35d5ecae7f65b755f3c1716c",
"size": 4316
},
"skills/aip-reference-style/references/read-reference.md": {
"sha256": "85dd851b01395856c6635c8fb36a5584164dedb5f8d0048982a1bf4180b13a04",
"size": 6738
},
"skills/aip-reference-style/references/style-pack.md": {
"sha256": "bc423f2f3e99680286e1a4be8e1e341876d52c78f096137b030fbe74f3a837b0",
"size": 9598
},
"skills/aip-reference-style/references/tools.md": {
"sha256": "cb3a2d3f9688a7f10fbc81e2a2d2a48ac5141f0f9b226e40bf306eeec6d40d78",
"size": 3669
},
"skills/aip-reference-style/scripts/caption_compare.py": {
"sha256": "bf81a5fdf5237936eadd13e7d401abe053745e0d74c54b63e2ec515ae1a74484",
"size": 15799
},
"skills/aip-reference-style/scripts/reference_frames.py": {
"sha256": "1540dad5a41dcbcdb7a7da4564fe45323d5a94fa05db79c742c56a595eaa2487",
"size": 28024
},
"skills/aip-setup/SKILL.md": {
"sha256": "67395aed411b6b9fe9f78fe226873171aa2f598f19982d6999ddadeca2ad3724",
"size": 11749
},
"skills/aip-setup/agents/openai.yaml": {
"sha256": "380674a88469c365e4070a9669132aad587783121fdea345fa628c3ec8959553",
"size": 121
},
"skills/aip/SKILL.md": {
"sha256": "bf1a27ea4887e9be755dd2ba4cc4d59006ff98d4114027db0a5383d51533234a",
"size": 23522
},
"skills/aip/agents/openai.yaml": {
"sha256": "f40cfee4ca86807a5f0b95e25ac70860b2a9a6fb791faee3e40da4608044f0da",
"size": 106
},
"skills/aip/references/aesthetic-rules.md": {
"sha256": "f79dd519a03375cbe596cdf373e3a16e365c26555a936bb7555ae39a173e1804",
"size": 18035
},
"skills/aip/references/duration.md": {
"sha256": "bfc17f6b91cccfbb7e60d493abf829da64d9b8612759250da922776f62eac57b",
"size": 980
},
"skills/aip/references/environment.md": {
"sha256": "6eab74a2fe282a650ca3b1e231b3c2ab5d9eb6be553e2ac4f9f651e513c85a02",
"size": 7384
},
"skills/aip/references/feedback.md": {
"sha256": "7370a786a0a7f06d085749d8437df160f87f7aa974c8bd9f0e59bc904595d182",
"size": 3229
},
"skills/aip/references/handoff.md": {
"sha256": "c3eb1e5f568fac2cb33fa6fc5c6b179d10df200b2e77b946050ab2fe73ce11e5",
"size": 8262
},
"skills/aip/references/host.md": {
"sha256": "b488b7ce94b7f35245aaf101104d76d94c420825d373f4ca186aadccfeceb818",
"size": 8439
},
"skills/aip/references/legacy-aip-line.md": {
"sha256": "0b386450acb48973da6fa0fb33694333bccc8439bc482a14811c0d69b5aa7ccf",
"size": 797
},
"skills/aip/references/multi-video-start.md": {
"sha256": "fa6c601be56971df7f5ba6935060fa22332fdca711bf6b9865bda8d751dafabc",
"size": 5303
},
"skills/aip/references/new-project.md": {
"sha256": "5a3357614d17088bcea9ea16324ad7dd1347efd9f3635723daa1525c2cda61ee",
"size": 12481
},
"skills/aip/references/publish.md": {
"sha256": "c023e57ee6e28ae656a4b693fd284e9a9fb844e53c083b24806e72ffef1d7f7a",
"size": 5568
},
"skills/aip/references/supplied-broll.md": {
"sha256": "5e93c642d3c8074a9aab836515dd443ab1c674c1605d1ddd352ae40cfbcb023f",
"size": 1178
},
"skills/aip/references/supporting-visuals.md": {
"sha256": "022aefd758fcfcf4a047a326d979c630ad66f48b958059ccf96cdde65c68b3b4",
"size": 3708
},
"skills/aip/references/web-assignment.md": {
"sha256": "47374972c0e424af04d7b1f9b4125a570fed80cd57ca4af76fa02aca62b597b2",
"size": 2221
},
"skills/aip/references/workspace.md": {
"sha256": "35f3b0436356b97ec5d848cfd32ee08cf77c1f3e619646c9b97e34aeca883ad0",
"size": 4443
},
"skills/aip/scripts/caption_cues.py": {
"sha256": "26137c7e5a4c83bc985ec27a398322a402a3bfd825b56ae940279780db5f6910",
"size": 8033
},
"skills/aip/scripts/editing_script_sync.py": {
"sha256": "3f355e4a9e1033445b9a6f435c28fe8c40e9b4899f4a2b6d9fe0ff1db33f6096",
"size": 38003
},
"skills/aip/scripts/preflight.py": {
"sha256": "ab4c5d1d84fd643067b405288a311b755488ae16149038984c8a6da5fa2dc982",
"size": 15114
},
"skills/aip/scripts/source_files.py": {
"sha256": "e1fb77a599405e8c08342f194480ad8a29343545f7cf1a9fb1e28fdce048cc32",
"size": 12184
},
"skills/aip/scripts/speaker_effects.py": {
"sha256": "4684a48ddeafc3f2c46f8cdd1d4ec7377b3c05e3a5cb48966f2be819e75247b5",
"size": 22349
},
"skills/aip/scripts/upload_batch.py": {
"sha256": "ee080be7ad8b66c1b17c823bbf0f84f2fd306ad7520f27bd5dae07d136f29b9c",
"size": 4879
}
}
}SHA-256 of public snapshot: 9461181e6f1ad7237ef7837b52c15ec7abc187c75f4b2d4d9c6d2431fda6e65d