Skip to content

[Feature] 1-Key Live Stream Recording & Track Ripper (R) #7

Description

@arkalon76

📌 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

  1. 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.
  2. 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.
  3. 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

  • Pressing R starts recording active audio stream without disrupting live audio playback.
  • Pressing R again or stopping the station completes and closes the recording file cleanly.
  • Active recording status and elapsed duration 🔴 REC [mm:ss] render dynamically in playerbar.go.
  • Recorded audio files are playable in standard audio players (VLC, QuickTime, mpv).
  • Unit tests for recording file path formatting, start/stop lifecycle, and error handling.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions