# zik
A TUI web radio player with a real-time audio visualizer, built with Rust and ratatui.
<div align="center">
<img src="./zik-view.gif" width="768" height="402"/>
</div>
Plays HLS/m3u8 radio streams via mpv and displays a spectrum visualizer captured from PulseAudio/PipeWire system audio output.
## Dependencies
### Runtime
- **mpv** - audio playback
- **PulseAudio** or **PipeWire** (with PulseAudio compatibility) - audio capture for the visualizer
### Build
- **Rust** (edition 2024)
- **libpulse** development headers
#### Arch Linux
```sh
sudo pacman -S mpv libpulse rust
```
#### Debian/Ubuntu
```sh
sudo apt install mpv libpulse-dev rustc cargo
```
## Build
```sh
cargo build --release
```
The binary is at `target/release/zik`.
## Install
```sh
cargo install --path .
```
## Configuration
Create `~/.config/zik/config.toml`:
```toml
[ui]
bar_color = "Magenta"
[radios]
fip = "https://stream.radiofrance.fr/fip/fip_hifi.m3u8"
fiprock = "https://stream.radiofrance.fr/fiprock/fiprock_hifi.m3u8"
fipjazz = "https://stream.radiofrance.fr/fipjazz/fipjazz_hifi.m3u8"
fipgroove = "https://stream.radiofrance.fr/fipgroove/fipgroove_hifi.m3u8"
fippop = "https://stream.radiofrance.fr/fippop/fippop_hifi.m3u8"
fipelectro = "https://stream.radiofrance.fr/fipelectro/fipelectro_hifi.m3u8"
fipmonde = "https://stream.radiofrance.fr/fipworld/fipworld_hifi.m3u8"
fipreggae = "https://stream.radiofrance.fr/fipreggae/fipreggae_hifi.m3u8"
fipnouveaute = "https://stream.radiofrance.fr/fipnouveautes/fipnouveautes_hifi.m3u8"
```
### `[ui]`
| `bar_color` | Visualizer bar color | `Magenta` |
Available colors: `Black`, `Red`, `Green`, `Yellow`, `Blue`, `Magenta`, `Cyan`, `White`, `DarkGray`, `LightRed`, `LightGreen`, `LightYellow`, `LightBlue`, `LightMagenta`, `LightCyan`.
### `[radios]`
A map of `name = "url"` entries. Each entry is a radio station with an HLS/m3u8 stream URL. You can add any stream that mpv supports.
## Usage
```sh
# Play the first radio alphabetically
zik
# Play a specific radio
zik fipjazz
```
### Keybindings
| `Enter` | Play / stop selected radio |
| `j` / `Down` | Next radio |
| `k` / `Up` | Previous radio |
| `s` | Toggle radio selector panel |
| `Esc` | Close selector panel |
| `?` | Toggle keybindings help |
| `q` | Quit |