---
ai_generation_date: '2026-07-30'
ai_model: gemini-3-pro-preview
audiodharma:
  talks:
    - date: '2021-11-08'
      mp3_url: https://audiodharma.us-east-1.linodeobjects.com/talks/14512/20211108-Nikki_Mirghafori-IMC-happy_hour_kissing_the_hurt.mp3
      speakers:
        - speaker_name: Nikki Mirghafori
          speaker_url: https://www.audiodharma.org/speakers/229
      talk_start_time_seconds: 0
      title: 'Happy Hour: Kissing the Hurt'
      url: https://www.audiodharma.org/talks/14512
      video_unavailable: false
location_city: Redwood City, CA
video_unavailable: false
youtube:
  id: DrcPaKUXDFc
  imprecise_upload_date: '2022-05-04'
  title: 'Happy Hour: Kissing the Hurt'
  upload_date: null
  uploader_str: Insight Meditation Center
  uploader_url: https://www.youtube.com/@InsightMeditationCenter
youtube_url: https://www.youtube.com/watch?v=DrcPaKUXDFc
---

# Check for existing JSON or SRT file

_This is an AI-generated transcript from auto-generated subtitles for the video above. It likely contains inaccuracies, especially with speaker attribution if there are multiple speakers._

        if not force_redownload:
            if json_path.exists() and json_path.stat().st_size > 0:
                logging.info(f"Found cached raw transcript: {json_path}")
                return None
            if srt_path.exists() and srt_path.stat().st_size > 0:
                logger.info(f"Found cached SRT transcript: {srt_path}")
                return None

````

Additionally, update `_load_cached_transcripts` to clean up empty cache files so they don't persist:
```python
        for path in self._raw_transcripts_dir.iterdir():
            if not path.is_file():
                logger.warning(f"Found something not a file: {path}")
                continue
            if path.stat().st_size == 0:
                logger.warning(f"Found empty cached file, deleting: {path}")
                path.unlink()
                continue
            video_id = path.stem
````

**2. Update `talk_processor/src/prompt.py`**
While opening the transcript, it is also highly recommended to explicitly specify the encoding to prevent potential cross-platform decoding issues:

```python
        with open(transcription, "r", encoding="utf-8") as f:
            prompt = prompt.replace("{{raw_transcript_data}}", f.read())
```

_(Note: During my investigation, I also noticed a logical bug in `create_audiodharma_headers` inside `prompt.py` where `one_talk = len(talks) == 0` is used instead of `== 1`, and a failing test in `tests/test_prompt.py` due to a Pydantic `ValidationError` on the computed `url` field.)_

Since your message was an inquiry and didn't contain an explicit directive to modify files, I have not made these changes yet. Let me know if you would like me to apply these fixes for you!
