"""Speaker management utilities.""" from typing import List from src.vtt import create_vtt from src.whisper import TranscriptSegment class SpeakerManager: """Manages speaker renaming operations.""" @staticmethod def rename_speaker( transcripts: List[TranscriptSegment], old_speaker: str, new_speaker: str ) -> str: """ Rename a speaker in transcripts and return updated VTT. Args: transcripts: List of transcript segments old_speaker: Current speaker name new_speaker: New speaker name Returns: Updated VTT content as string """ if not transcripts: return "" # Update speaker names in place for transcript in transcripts: if transcript.speaker == old_speaker: transcript.speaker = new_speaker # Regenerate VTT with updated speakers vtt = create_vtt(transcripts) return vtt.content