📌 Feature Summary
Implement 1-Key Live Stream Recording & Track Ripping to allow users to record the active internet radio stream to an audio file on disk with a single keystroke (R), automatically tagging files with station and ICY song metadata.
🎯 Motivation & User Story
"As an internet radio listener, I often encounter exclusive live DJ sets, underground electronic mixes, and acoustic radio broadcasts that are not available anywhere on Spotify or Apple Music. I want to press R to capture the stream directly to my music folder."
Stream recording is a classic, celebrated feature from legacy tools like PyRadio and streamripper. Integrating audio capture into halpradio allows users to archive their favorite radio moments effortlessly.
⌨️ Proposed UX & Keybindings
- Trigger Key: Press
R (Shift+r) to toggle recording on/off for the currently active stream.
- Recording Directory: Defaults to
~/Music/halpradio/ (creates directory if missing; configurable in config.yaml).
- Smart Filename & Tagging:
- Auto-generates filenames based on active ICY metadata:
~/Music/halpradio/[StationName] - [Artist] - [Title] - 20260815_223000.mp3
- If no track metadata is available:
~/Music/halpradio/[StationName] - Recording - 20260815_223000.mp3
- UI Feedback:
- Playerbar displays a pulsing recording badge:
🔴 REC [00:02:45]
- Status bar displays confirmation message upon completion:
✅ Saved recording to ~/Music/halpradio/SomaFM - Tycho - A Walk.mp3 (18.4 MB)
🏗️ Technical & Architectural Guidelines
- Audio Capture Strategies by Backend (
pkg/player/):
- mpv Backend: Send IPC command or launch with
--record-file=<path> / stream dump command.
- Native Go & FFmpeg Backends: Tee the incoming HTTP audio stream using an
io.MultiWriter feeding both the audio decoder and an asynchronous buffered file writer.
- Concurrency & Thread Safety:
- Guard recording state, file handles, and byte counters behind
player.Manager.mu.
- Ensure disk I/O occurs on a background goroutine to prevent audio stutter or UI frame drops.
- Graceful Teardown:
- When user stops playback (
s), switches stations, or quits (q), cleanly flush and close active recording files without corrupting the container header.
✅ Acceptance Criteria
📌 Feature Summary
Implement 1-Key Live Stream Recording & Track Ripping to allow users to record the active internet radio stream to an audio file on disk with a single keystroke (
R), automatically tagging files with station and ICY song metadata.🎯 Motivation & User Story
Stream recording is a classic, celebrated feature from legacy tools like PyRadio and streamripper. Integrating audio capture into
halpradioallows users to archive their favorite radio moments effortlessly.⌨️ Proposed UX & Keybindings
R(Shift+r) to toggle recording on/off for the currently active stream.~/Music/halpradio/(creates directory if missing; configurable inconfig.yaml).🔴 REC [00:02:45]✅ Saved recording to ~/Music/halpradio/SomaFM - Tycho - A Walk.mp3 (18.4 MB)🏗️ Technical & Architectural Guidelines
pkg/player/):--record-file=<path>/ stream dump command.io.MultiWriterfeeding both the audio decoder and an asynchronous buffered file writer.player.Manager.mu.s), switches stations, or quits (q), cleanly flush and close active recording files without corrupting the container header.✅ Acceptance Criteria
Rstarts recording active audio stream without disrupting live audio playback.Ragain or stopping the station completes and closes the recording file cleanly.🔴 REC [mm:ss]render dynamically inplayerbar.go.