Calculate the total length of a transcript in seconds. Args: transcript_start: Start times for transcript segments (format depends on TranscriptReader) transcript_end: End times for transcript segments (format depends on TranscriptReader) Returns: Total length
(transcript_start: Any, transcript_end: Any)
| 69 | |
| 70 | |
| 71 | def calculate_transcript_length(transcript_start: Any, transcript_end: Any) -> float: |
| 72 | """ |
| 73 | Calculate the total length of a transcript in seconds. |
| 74 | |
| 75 | Args: |
| 76 | transcript_start: Start times for transcript segments (format depends on TranscriptReader) |
| 77 | transcript_end: End times for transcript segments (format depends on TranscriptReader) |
| 78 | |
| 79 | Returns: |
| 80 | Total length in seconds, or 0 if calculation fails |
| 81 | """ |
| 82 | if not transcript_start or not transcript_end: |
| 83 | return 0.0 |
| 84 | |
| 85 | try: |
| 86 | # Calculate difference returns time in milliseconds, convert to seconds |
| 87 | return calculate_difference(transcript_start, transcript_end) / 1000.0 |
| 88 | except (ValueError, IndexError, TypeError) as e: |
| 89 | print(f"Warning: Failed to calculate transcript length: {e}") |
| 90 | return 0.0 |
| 91 | |
| 92 | |
| 93 | def process_transcript_file( |
no test coverage detected