blog-backup/PODCAST_SUMMARY.md
OpenClaw Bot 9720390e1a Add podcast feature with TTS, RSS feed, and web player
- Multi-provider TTS service (OpenAI, Piper, macOS say)
- Supabase Storage integration for audio files
- RSS 2.0 feed with iTunes extensions for podcast distribution
- Web audio player at /podcast page
- Integration with daily digest workflow
- Manual TTS generation script
- Complete documentation in PODCAST_SETUP.md
2026-02-23 20:15:27 -06:00

4.4 KiB

Podcast Implementation Summary

What Was Built

A complete podcast solution for the Daily Digest blog that automatically converts blog posts to audio using Text-to-Speech (TTS) and distributes them via RSS feed.

Features Delivered

1. TTS Service (src/lib/tts.ts)

  • Multi-provider support: OpenAI (paid), Piper (free), macOS say (free)
  • Text preprocessing: Automatically strips markdown, URLs, and code blocks
  • Async generation: Non-blocking to not delay post creation
  • Error handling: Graceful fallback if TTS fails

2. Audio Storage (src/lib/storage.ts)

  • Supabase Storage integration: Uses existing Supabase project
  • Automatic bucket creation: Creates podcast-audio bucket if needed
  • Public access: Audio files accessible for podcast apps

3. RSS Feed (src/app/api/podcast/rss/route.ts)

  • RSS 2.0 with iTunes extensions: Compatible with Apple Podcasts, Spotify, Google Podcasts
  • Auto-updating: Pulls latest episodes from database
  • Proper metadata: Titles, descriptions, duration, publication dates

4. Podcast Page (src/app/podcast/page.tsx)

  • Web audio player: Play episodes directly on the site
  • Episode listing: Browse all available podcast episodes
  • Subscribe links: RSS, Apple Podcasts, Spotify
  • Responsive design: Works on mobile and desktop

5. Integration with Digest Workflow

  • Updated /api/digest: Now triggers TTS generation after saving post
  • Optional audio: Can disable with generateAudio: false
  • Background processing: Doesn't block the main response

6. Manual TTS Script (src/scripts/generate-tts.ts)

  • Single post: npm run generate-tts -- <post_id>
  • Batch processing: npm run generate-tts:all
  • Force regeneration: --force flag to overwrite existing

7. UI Updates

  • Blog post audio player: Shows audio player for posts with audio
  • Podcast link in header: Easy navigation to podcast page
  • Visual indicators: Shows which posts have audio

Files Created/Modified

New Files

src/
├── app/
│   ├── api/podcast/rss/route.ts     # RSS feed endpoint
│   └── podcast/page.tsx             # Podcast web player
├── lib/
│   ├── tts.ts                       # TTS service abstraction
│   ├── storage.ts                   # Supabase storage helpers
│   └── podcast.ts                   # RSS generation utilities
├── scripts/
│   └── generate-tts.ts              # Manual TTS generation script
└── ../PODCAST_SETUP.md              # Setup documentation

Modified Files

src/
├── app/
│   ├── api/digest/route.ts          # Added TTS trigger
│   └── page.tsx                     # Added audio player, podcast link
├── ../package.json                  # Added generate-tts scripts
├── ../tsconfig.json                 # Added scripts to includes
└── ../.env.local                    # Added TTS environment variables

Configuration

Environment Variables

# Enable TTS generation
ENABLE_TTS=true

# TTS Provider: openai, piper, or macsay
TTS_PROVIDER=openai

# OpenAI settings (if using OpenAI)
OPENAI_API_KEY=sk-your-key-here
TTS_VOICE=alloy  # alloy, echo, fable, onyx, nova, shimmer

# Piper settings (if using Piper)
PIPER_MODEL_PATH=./models/en_US-lessac-medium.onnx

Database Schema

ALTER TABLE blog_messages 
ADD COLUMN audio_url TEXT,
ADD COLUMN audio_duration INTEGER;

URLs

  • RSS Feed: https://blog-backup-two.vercel.app/api/podcast/rss
  • Podcast Page: https://blog-backup-two.vercel.app/podcast
  • Blog: https://blog-backup-two.vercel.app

Cost Analysis

Component Provider Monthly Cost
TTS OpenAI ~$2-4
TTS Piper/macOS $0
Storage Supabase $0 (free tier)
RSS Hosting Vercel $0
Total $0-4/month

Next Steps to Deploy

  1. Database: Run the SQL to add audio_url and audio_duration columns
  2. Supabase Storage: Create podcast-audio bucket (or let app auto-create)
  3. Environment: Add ENABLE_TTS=true and OPENAI_API_KEY to production
  4. Deploy: npm run build && vercel --prod
  5. Test: Generate a test episode and verify RSS feed
  6. Submit: Add RSS URL to Apple Podcasts, Spotify, etc.

Documentation

See PODCAST_SETUP.md for complete setup instructions, troubleshooting, and usage guide.