Refactor transcript file handling to use JSON metadata
This commit changes the way transcriptions are stored and accessed. Instead of using plain text files (`.transcript.txt`), transcriptions will now be part of a JSON metadata file (`<stem>.json`). This allows for richer metadata to be stored alongside the transcript, such as duration, and provides a more robust mechanism for tracking transcription states. The changes include: - Updating documentation and code to reflect the new `.json` file extension. - Modifying file handling logic to read and write JSON metadata. - Adjusting tests to accommodate the new file format.
This commit is contained in:
@@ -31,7 +31,7 @@ pub fn seed_case(data_path: &Path, slug: &str, case_id: &str) -> PathBuf {
|
||||
/// `transcript`:
|
||||
/// - `None` → no sidecar written (recording stays in `Pending` state).
|
||||
/// - `Some(text)` with whitespace-only `text` → sidecar with
|
||||
/// `Transcript::Silent` (matches the old `transcript.txt = ""` rule).
|
||||
/// `Transcript::Silent` (mirrors the worker's classification rule).
|
||||
/// - `Some(text)` non-empty → sidecar with `Transcript::Content`.
|
||||
///
|
||||
/// Returns the audio filename (no path) so the caller can feed it back
|
||||
@@ -79,8 +79,7 @@ pub fn seed_recording_meta(
|
||||
|
||||
/// Map a free-text transcript to the `Transcript` variant the worker
|
||||
/// would have produced for it: whitespace-only → `Silent`, otherwise
|
||||
/// `Content`. Mirrors the old `transcript.txt = "" ⇒ Silent` rule so
|
||||
/// existing tests keep their meaning.
|
||||
/// `Content`. Matches `worker::run`'s post-Whisper classification.
|
||||
fn transcript_for(text: &str) -> Transcript {
|
||||
if text.trim().is_empty() {
|
||||
Transcript::Silent
|
||||
|
||||
Reference in New Issue
Block a user