# Daily Digest Podcast Generator

Converts daily digest blog posts into audio podcast format using OpenAI TTS.

## Overview

This system automatically:
1. Fetches the latest daily digest from blog-backup
2. Converts the content to speech using OpenAI TTS
3. Generates an RSS feed for podcast distribution
4. Stores audio files for serving

## Setup

### 1. OpenAI API Key

You need an OpenAI API key with TTS access:

```bash
# Create the environment file
echo "OPENAI_API_KEY=sk-your-key-here" > ~/.openclaw/workspace/.env.openai
```

Get your API key from: https://platform.openai.com/api-keys

### 2. Test the Generator

```bash
cd ~/.openclaw/workspace/scripts/podcast-generator
./generate-podcast.sh
```

### 3. Manual Generation

To generate a podcast for a specific digest:

```bash
# The script auto-detects the latest digest
./generate-podcast.sh
```

### 4. RSS Feed

The RSS feed is generated at:
- Local: `~/.openclaw/workspace/podcast/rss.xml`
- Web: Should be hosted on Mission Control or deployed to static hosting

## Cost Estimate

- Daily digest: ~2,000 characters
- OpenAI TTS: $0.015 per 1,000 characters
- **Cost per episode: ~$0.03**
- Monthly cost (30 episodes): ~$0.90

## Architecture

```
Daily Digest Posted (blog-backup)
         ↓
Cron Trigger (7:30 AM CST)
         ↓
Podcast Generator Script
         ↓
OpenAI TTS API
         ↓
MP3 File + RSS Update
         ↓
Mission Control (/podcast/rss.xml)
         ↓
Podcast Apps (Apple, Spotify, etc.)
```

## Files

- `generate-podcast.sh` - Main conversion script
- `~/.openclaw/workspace/podcast/audio/` - Stored MP3 files
- `~/.openclaw/workspace/podcast/rss.xml` - RSS feed

## Integration with Daily Digest

Add to the daily digest cron job after successful posting:

```bash
# After posting digest, generate podcast
/Users/mattbruce/.openclaw/workspace/scripts/podcast-generator/generate-podcast.sh
```

## Future Enhancements

- [ ] Add intro/outro music
- [ ] Multiple voice options
- [ ] Chapter markers for sections
- [ ] Auto-upload to Spotify for Creators
- [ ] Analytics tracking

## Troubleshooting

### "OPENAI_API_KEY not set"
Create the `.env.openai` file with your API key.

### "No digest found"
The blog-backup may not have a digest for today yet. Check https://blog.twisteddevices.com

### Audio file is empty
Check OpenAI API rate limits and billing status.

## License

Part of OpenClaw infrastructure.