* Formats a recording header plus speaker-attributed transcript lines into plain text.
( recording: GrainRecording, segments: GrainTranscriptSegment[] )
| 251 | * Formats a recording header plus speaker-attributed transcript lines into plain text. |
| 252 | */ |
| 253 | function formatTranscriptContent( |
| 254 | recording: GrainRecording, |
| 255 | segments: GrainTranscriptSegment[] |
| 256 | ): string { |
| 257 | const parts: string[] = [] |
| 258 | |
| 259 | parts.push(`Meeting: ${recordingTitle(recording)}`) |
| 260 | if (recording.start_datetime) parts.push(`Date: ${recording.start_datetime}`) |
| 261 | if (recording.duration_ms != null) { |
| 262 | const minutes = Math.round(recording.duration_ms / 60000) |
| 263 | parts.push(`Duration: ${minutes} minutes`) |
| 264 | } |
| 265 | const names = participantNames(recording) |
| 266 | if (names.length > 0) parts.push(`Participants: ${names.join(', ')}`) |
| 267 | |
| 268 | parts.push('') |
| 269 | parts.push('--- Transcript ---') |
| 270 | for (const segment of segments) { |
| 271 | const text = segment.text?.trim() |
| 272 | if (!text) continue |
| 273 | const speaker = segment.speaker?.trim() || 'Unknown' |
| 274 | parts.push(`${speaker}: ${text}`) |
| 275 | } |
| 276 | |
| 277 | return parts.join('\n') |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * Fetches a single recording's metadata from the v2 recordings endpoint. |
no test coverage detected