SnapRadio is a modern, web-based interface for playing global Internet radio and Twitch streams on headless systems.
It designed for seamless integration with Snapcast via PipeWire/PulseAudio FIFOs allowing you to sned Internet radio or Twitch streams to your snapcast server.
Built with FastAPI and Tailwind CSS, it provides a responsive mobile-friendly experience for managing your radio listening and media downloads.
- Global Radio Discovery: Browses tens of thousands of stations worldwide via the Radio-Browser.info API.
- Configurable Defaults: Set your preferred default country in
.envusing the 2-code country alpha code (e.g.,DEFAULT_COUNTRY=GB). Country Codes . - Snapcast Ready: Orchestrates audio routing to local FIFOs for multi-room synchronization.
- Favourites: Save your favourite stations for quick access
- Track History: Automatically logs played tracks from radio stations (where information is available from the stream)
- Recording Function: Record stream to local mp3
- Local Player: Basic player to play on the local device. For those times when you have your speakers connected via Bluetooth
- Twitch Integration: Play your followed Twitch audio streams.
- Media Downloader: A versatile background downloader for Mixcloud, YouTube, and other platforms with automatic MP3 conversion, ID3 tagging, and artwork embedding.
- Mobile Optimized: A clutter-free, responsive UI that works perfectly on phones and tablets.
- FastAPI Backend: For concurrency and speed.
- Global Data Source: Pulls live data from the Radio-Browser community project.
SnapRadio routes audio to the following PipeWire/PulseAudio devices (configured in .env):
| Source | Default FIFO | Purpose |
|---|---|---|
| Radio Player | /tmp/snapcastDAB |
Main radio stream output |
| Twitch Player | /tmp/Twitch |
Dedicated Twitch audio output |
ffmpeg: Required for audio transcoding and downloading.pw-cat: Required for PipeWire audio playback.python3-venv: Required for Running the application
apt install ffmpeg pipewire-bin python3-venvSnapRadio requires Python 3.10+.
python3 -m venv ~/venv
source ~/venv/bin/activate
pip install -r requirements.txtgit clone https://github.com/GenXStreamer/Snapradio.git /opt/Snapradio
cd /opt/Snapradio
cp .env_example .envCreate PipeWire pulse-sink configurations to host the FIFOs. Example for snapcastDAB:
File: ~/.config/pipewire/pipewire-pulse.conf.d/snapcastDAB.conf
pulse.cmd = [
{ cmd = "load-module"
args = "module-pipe-sink file=/tmp/snapcastDAB sink_name=snapcastDAB format=s16le rate=48000 channels=2"
}
]File: ~/.config/pipewire/pipewire-pulse.conf.d/Twitch.conf
pulse.cmd = [
{ cmd = "load-module"
args = "module-pipe-sink file=/tmp/Twitch sink_name=Twitch format=s16le rate=48000 channels=2"
}
]The main entry point is main.py.
source ~/venv/bin/activate
python main.pyBy default, the UI is available at http://localhost:8882.
Configurable in .env
Alternatively, start/stop via systemd
Important it is presumed you have a active logged user session on your device; by default pipewire runs on logged in user sessions; and the systemd user services start on user login. I belive it is possible to run pipewire without requiring a logged in session, but I have not explored this option. Pipewire Headless
In my setup (Mint Linux) I autologin my snapcast user to a minimal desktop.
The built-in Downloader supports a wide range of URLs thanks to yt-dlp.
- Processes jobs in a background queue.
- Shows real-time status: Queued → Downloading → Encoding → Done.
- Status persists across page refreshes and navigation.
- Saves tagged MP3s to the
downloads/directory.
To use Twitch features, you must provide a Client ID and Secret in your .env.
- Register an app at Twitch Dev Console.
- Important: Set the OAuth Redirect URL in the Twitch console to
http://localhost:8889/callback. - Fill in
TWITCH_CLIENT_IDandTWITCH_CLIENT_SECRETin your.envfile. - Run the token helper script to authorize your account and generate tokens:
This script will automatically update your
python get_twitch_tokens.py
.envwith the requiredTWITCH_USER_TOKENandTWITCH_REFRESH_TOKEN. - You also need to find your numeric Twitch User ID (e.g. using an online lookup tool) and add it to
TWITCH_USER_IDin.envto see your followed channels. https://www.streamweasels.com/tools/convert-twitch-username-%20to-user-id/
Setup your FIFO inputs in snapcast server.
source entries in /etc/snapserver.conf:
source = pipe:///tmp/snapcastDAB?name=Radio&mode=read
source = pipe:///tmp/Twitch?name=Twitch&mode=read- Radio-Browser.info: For providing the incredible open-source station database.
- Snapcast: The foundation of this multi-room setup.
- ffmpeg: THE audio and video converter!
- Streamlink: pipes video streams from various services
- yt-dlp: Powering the media downloader.
TBA