feat(cli): add 'omi conversation export' for SRT subtitle output

AM
1mo ago
+205-0

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=true through the existing client
  • renders transcript_segments as UTF-8 SRT using each segment's own start/end timestamps
  • 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 --force is passed.
  • No silent empty output - if the conversation has no valid transcript segments, it exits with a clear UsageError and 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,mmm timestamps, text) + JSON payload segments/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 start treated 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.