$ show mxpv/podsync
Podsync is a Go-based service that converts video/audio content from YouTube, Vimeo, SoundCloud, and Twitch into podcast RSS feeds. It downloads media via yt-dlp, stores metadata in BadgerDB, and serves feeds via an HTTP server. The architecture is modular: platform-specific builders (pkg/builder/) query APIs to discover episodes, a downloader (pkg/ytdl/) handles media retrieval, and a feed generator (pkg/feed/) produces iTunes-compatible RSS and OPML. The system supports cron-based scheduling, episode filtering by regex/duration/age, cleanup policies, API key rotation, and hooks for custom workflows. It runs as a standalone binary or Docker container with local or S3 storage.
The LLM identified 3 files worth highlighting for reuse:
Implements a KeyProvider interface with two strategies: FixedKeyProvider for single keys and RotatedKeyProvider for round-robin rotation across multiple keys. The rotation is thread-safe via a mutex and handles edge cases like empty key lists. This pattern is reusable in any service that needs to distribute API quota across multiple credentials.
Provides an ExecHook struct that executes shell commands with configurable timeout and environment variable injection. Supports both single-command (via /bin/sh -c) and multi-argument execution. Handles nil hooks gracefully and returns combined stdout/stderr on failure. This is a reusable pattern for post-download or error notification hooks in any pipeline.
Contains utility functions for generating episode filenames from configurable templates ({{id}}, {{title}}, {{pub_date}}, {{feed_id}}), including validation of template tokens and sanitization of output filenames. Also includes EpisodeName and LegacyEpisodeName functions that handle extension normalization. These functions are self-contained and could be extracted for any project needing safe, template-based filename generation.