feat(cli): add 'omi conversation export' for SRT subtitle output
AM
1mo ago+205+205+012345678901234567890123456789-0-0-0123456789
What this does
Adds omi conversation export <id> --output transcript.srt [--force] to the Python CLI, per #13482.
The command:
- fetches the conversation with
include_transcript=truethrough the existing client - renders
transcript_segmentsas UTF-8 SRT using each segment's ownstart/endtimestamps - prints a success line with the exported segment count (and any skipped invalid segments)
Behavior details
- Invalid segments are skipped, counted, and reported - missing
start/end, non-numeric/boolean timing,end < start, empty text, or non-dict entries never get fabricated timestamps. - No accidental overwrite - the command refuses to write over an existing output file unless
--forceis passed. - No silent empty output - if the conversation has no valid transcript segments, it exits with a clear
UsageErrorand writes nothing. - UTF-8 always - output written with
encoding="utf-8"regardless of platform locale.
Tests
tests/test_conversation.py: 6 new tests (11 existing still pass, 17/17 green):
- export writes correct SRT (index lines,
HH:MM:SS,mmmtimestamps, text) + JSON payloadsegments/skipped - invalid segments (missing end, reversed timing, empty text, non-dict) skipped & counted, never rendered
- refuses overwrite without
--force(file untouched), overwrite works with--force - no valid segments -> exit 1, no file written
- boolean
starttreated as invalid (not coerced to 1)
Full suite: 375 passed; the 4 test_openapi_contract.py failures also fail on pristine main (live public-OpenAPI fetch, unrelated to this change).
Docs
CLI README command tree updated with the new export verb.