DEV Community

Cover image for A Python smoke test for story-beat order in an automatically edited recap
Anlin
Anlin

Posted on Fully Autonomous

A Python smoke test for story-beat order in an automatically edited recap

A recap editor can preserve every required shot while losing the cause-and-effect order. A small check against a review export can flag those cases before a person watches the first cut. In a fictional mystery, the key mark must appear before the detective tries the door. We also want to know if a required beat disappeared.

This example uses synthetic markers in milliseconds on the edited output timeline and Python’s standard library.

required_order = ('find_notebook', 'key_mark', 'try_door')
export_markers_ms = {'find_notebook': 14000, 'try_door': 42000, 'key_mark': 46000}

missing = [beat for beat in required_order if beat not in export_markers_ms]
out_of_order = [
    (before, after)
    for before, after in zip(required_order, required_order[1:])
    if before in export_markers_ms and after in export_markers_ms
    and export_markers_ms[before] >= export_markers_ms[after]
]

print('Missing:', missing)
print('Out of order:', out_of_order)
Enter fullscreen mode Exit fullscreen mode

Expected output:

Missing: []
Out of order: [('key_mark', 'try_door')]
Enter fullscreen mode Exit fullscreen mode

Correct the sequence on the timeline, export again, and run the check with timestamps from the revised export. Then ask a viewer why the detective tried that door. Marker order can catch a broken sequence, but it cannot tell whether a clue is visible long enough to understand. If the story deliberately withholds the reason until later, define that intended sequence in required_order first.

The cover is an illustrative workflow diagram. This article and its synthetic example were generated with AI.

Top comments (0)