Skip to main content

pyode

A simple terminal internet radio player: a Textual TUI over libmpv, with a station library kept in a plain CSV file and discovery via radio-browser.info.

pyode playing SomaFM Groove Salad

Stations on the left, what is on air on the right, and a signal meter that reads the decoded stream — so it keeps moving even when you have it muted.

Status

Complete and usable.

  • Phase 1 — player core (libmpv, ICY metadata, volume, error reporting)
  • Phase 2 — CSV station library (atomic writes, spreadsheet-safe)
  • Phase 3 — radio-browser.info API client
  • Phase 4 — Textual UI
  • Phase 5 — CLI polish

Installation

Install libmpv for your platform (below), then install the Python application:

uv tool install pyode-radio
pyode

Or install into an activated Python virtual environment with pip install pyode-radio. The distribution is named pyode-radio because PyODE on PyPI is an unrelated physics library. Both installers create the pyode command automatically; no shell wrapper or source checkout is needed. If uv's tool directory is not on PATH, run uv tool update-shell and restart your shell.

To run unreleased changes, install from a checkout with uv tool install . or pip install .. Either way, libmpv remains a separately installed native dependency.

Requirements

Python 3.12+ and libmpv — the shared library, which is not always the same thing as the mpv player.

Platform Install
Arch / CachyOS sudo pacman -S mpv
Debian / Ubuntu sudo apt install libmpv2
Fedora sudo dnf install mpv-libs
openSUSE sudo zypper install libmpv2
macOS brew install mpv
Windows see below — installing mpv is not enough

pyode finds the library itself, including in the places the dynamic loader does not look on its own: Homebrew's /opt/homebrew/lib and /usr/local/lib, MacPorts, Scoop and Chocolatey install trees, and the lib directory beside an mpv binary on your PATH. No environment variable should be necessary.

If one is, PYODE_LIBMPV takes the library file or the directory holding it, and pyode --libmpv prints every place that was searched and what was found there — start there when playback will not begin.

Windows

Every Windows mpv package — Scoop, Chocolatey, winget, and the official builds — ships mpv.exe as a single statically linked binary containing no libmpv DLL, so scoop install mpv alone will not get pyode running. Get the library from the separate development build:

  1. Download mpv-dev-x86_64-<date>-git-<hash>.7z (or mpv-dev-aarch64-… on Arm) from zhongfly/mpv-winbuild releases.
  2. Extract libmpv-2.dll into %LOCALAPPDATA%\pyode\lib.

pyode searches that directory, so nothing else needs configuring. Run pyode --libmpv to confirm it was picked up. WSL is not required.

Legacy SHOUTcast v1 stations

A handful of older stations (SLAY Radio, for one) run SHOUTcast v1 servers that reply with a bare ICY 200 OK status line instead of HTTP/1.1 200 OK. Everything after that line is ordinary HTTP, but libcurl has always refused it, and since August 2026 so does ffmpeg ("Malformed HTTP status line"). That change is already in libmpv builds made from current ffmpeg, such as the zhongfly/mpv-winbuild builds for Windows, and will reach other platforms with ffmpeg's next release.

pyode plays these stations anyway. When a plain http:// station fails before it starts, pyode tries it once more through a small relay of its own on 127.0.0.1, which fetches the stream and changes ICY to HTTP/1.0 on that first line, passing everything else through untouched, track titles included. pyode remembers which stations needed it, so reconnects go straight through the relay. Stations that work directly never touch it, and HTTPS stations are never relayed.

pyode also turns off mpv's libcurl stream layer (the curl-enabled option) wherever a build has it, so streams go through ffmpeg as they always did.

Station library

Stations live in a CSV file at ~/.config/pyode/stations.csv (override with PYODE_STATIONS_FILE). It is meant to be edited by hand or in a spreadsheet; unknown columns are ignored, missing ones take defaults, and a malformed row is skipped rather than taking the rest of the file down with it.

You can edit the file while pyode is running. pyode notices within a couple of seconds and reloads it, and before saving any change of its own it checks again, so your edit is never overwritten with an older copy. If the edited file cannot be read (saved in the wrong encoding, say), pyode says so and refuses to save over it until it is fixed. A station removed from the file while it plays carries on until you stop it.

Favourites are a favorite column rather than a second file, so a station has exactly one record and marking one cannot desynchronise from renaming or deleting it. Reading accepts true/yes/1/x; writing is always true/false.

Command line

pyode                          # open the interface
pyode --station groove         # open playing the first match in your library
pyode --list                   # print the library and exit
pyode --history                # print recently heard tracks and exit
pyode --libmpv                 # report where libmpv was looked for, and exit
pyode --no-visualiser          # start with the signal meter hidden
pyode --no-media-keys          # leave media keys and Now Playing to other apps
pyode --sleep 45               # stop playing after 45 minutes
pyode --keymap vim              # save Vim controls (arrows remain available)
pyode --keymap standard         # return to the standard controls
pyode --visualiser              # show the signal meter again
pyode --volume 60
pyode --stations ./other.csv   # use a different library file
pyode --play <url> --seconds 10 --silent   # headless, for testing a stream

--list writes the station names to stdout and a one-line summary to stderr, so it pipes cleanly.

On the very first run — when the library file does not yet exist — pyode seeds six varied stations so there is something to play immediately. Every seeded URL was checked against a live decoder. Seeding keys on the file never having existed, not on the library being empty: if you delete every station, it stays deleted.

Using it

Stations sit on the left, what is on air sits on the right, and the signal meter is bottom right. The rule between the two panes is a tuning scale: the needle marks where the playing station falls in your library.

Key Does
↑ / ↓ (Vim: k / j) Previous / next station
→ / p / Enter (Vim: l) Play the selected station
space Pause and resume
Shift+↑ / Shift+↓ (Vim: K / J) Move the selected station up / down the list
← / s (Vim: h) Stop
f Favourite the selected station
F (Shift+f) Toggle favourites-only / all stations
d Remove it from the library
u Undo the last removal, restoring its position
+ / - Volume
m Mute
t Track history
z Sleep timer: 15, 30, 45, 60, 90 minutes, off
r Record the playing station, or stop recording
R (Shift+r) Record this track, from its start
c Copy the current track title
v Show or hide the signal meter
/ Browse or search the directory
? Show controls for the active keymap
q Quit

The directory dialog opens on a short menu: popular stations, top voted, by genre, and by country. Enter opens a list or adds the highlighted station, and Escape goes back one level before it closes the dialog. Space plays the highlighted station so you can hear it first; Space again stops it. When the dialog closes, a station you added keeps playing, and otherwise pyode goes back to whatever was playing before. Typing a name or tag and pressing Enter searches instead. Down or Tab moves from the search box into the list; up/down work there, and Vim mode adds j/k. Text fields retain normal typing and cursor movement. Playback and library shortcuts apply only to the main screen. Undo lasts for this session and restores the station without restarting playback. Moving a station while favourites are shown swaps it with the neighbouring favourite.

Track history

Every track title a station announces is logged with the station and the time, so "what was that?" has an answer. Press t to see the most recent first; Enter or c copies the highlighted title, and c on the main screen copies whatever is on air now. pyode --history prints the log for scripts.

The log is a CSV file (history.csv in the platform's pyode data directory, or PYODE_HISTORY_FILE). pyode only appends to it and never trims it: it is yours to keep, edit, or delete. Set history = false in config.toml to keep history for the current session only, with nothing written to disk.

Copying uses the terminal's clipboard support (OSC 52), which works over SSH in most terminals, and the local clipboard tool as well (pbcopy, wl-copy, xclip, xsel, or clip) for terminals such as macOS Terminal that lack it. Not every station announces titles; many send only their own name.

When a stream fails

If a stream that was playing drops, pyode reconnects on its own, waiting a little longer each time (1, 2, 4, 8, then 15 seconds) before giving up. A connection that holds for 30 seconds earns a fresh set of attempts. A stream that drops while paused waits for you to press space.

If a station from the directory fails to start at all, pyode looks it up again by its directory ID. Station addresses change often; when the directory has a new one, pyode saves it to your library and tries again.

Recording

Press r while a station is playing to record it, and r again to stop. The top bar shows ● REC and how long it has run. pyode copies the stream as it arrives, without re-encoding, so the recording sounds exactly like the broadcast, in the station's own format: MP3, AAC (.aac), Ogg, FLAC, or Matroska (.mka) for anything else.

Beside each recording is a .cue track list, with one entry for every title the station announced and when it began. Players that read cue sheets, such as foobar2000 and mpv, can jump from track to track while the audio stays one unbroken file. Stations announce titles a little early or late, so the marks are approximate.

Recordings go to ~/Music/pyode, named after the station and the time, for example SomaFM Groove Salad 2026-11-08 21.30.mp3. Set PYODE_RECORDINGS_DIR to save them somewhere else. Stopping, changing station, or quitting ends the recording. If the stream drops and pyode reconnects, the recording carries on in a new file. Both the audio and the track list stay usable if pyode is closed unexpectedly.

To keep a single song, press R while it plays. pyode saves it from where it began, even if you tuned in or decided halfway through, and stops by itself when the station announces the next track. The file is named after the track, for example Tycho - Awake.mp3, and the top bar shows ● REC TRACK. This works because pyode holds the last stretch of the stream in memory: tens of minutes at typical bitrates, less for FLAC. A track you tuned into partway starts where you tuned in. Press R or r again to save early, and stopping or changing station saves what has played so far. It needs a station that announces its titles; for one that doesn't, use r.

Sleep timer

Press z to stop playing after 15 minutes; press it again for 30, 45, 60 and 90, and once more to turn it off. The time left shows in the top bar. Over the last 30 seconds the volume fades out, then playback stops and the volume goes back to where it was, so the next station does not start silent. Touching the volume during the fade cancels the timer. pyode --sleep 20 starts with a timer of any length; like --no-media-keys, it is not saved.

Media keys and Now Playing

pyode shows up wherever your desktop shows what is playing: Control Center's Now Playing panel on macOS, the media flyout beside the volume control on Windows, and on Linux anything that speaks MPRIS — GNOME and KDE Plasma's media controls, waybar, playerctl. It shows the track title when the station sends one, with the station beneath it, or else just the station. The play/pause key and the panel's buttons pause and resume, and the next and previous keys step through your station list, wrapping at the ends. With nothing playing, play starts the selected station. On Linux the panel's volume slider sets pyode's volume too.

playerctl -p pyode play-pause
playerctl -p pyode metadata title

This takes the media keys while pyode is open, as any music player would. To leave them to another app, start pyode with --no-media-keys; unlike the options below, it applies to that run only and is not saved.

Preferences

The keymap, volume, signal meter visibility, and whether to save track history are saved in the platform's pyode configuration directory (~/.config/pyode/config.toml on Linux). Use PYODE_CONFIG_FILE to choose another path. For example:

keymap = "vim"
volume = 60
visualiser = true
history = true

CLI options override saved values and are remembered when the interface opens. Volume and visualiser changes in the interface are saved immediately. Headless playback and diagnostic commands do not change preferences. Invalid settings produce an error identifying the file, so it can be corrected without losing it.

The meter plots signal level over time, not a frequency spectrum, because time is what the player measures. It reads the decoded stream ahead of the volume stage, so it keeps moving while muted — it tells you the stream is alive, not that sound is coming out. A stalled stream flatlines.

Start with it hidden using pyode --no-visualiser.

Station discovery

Stations come from radio-browser.info, a free volunteer-run directory. pyode identifies itself by User-Agent, asks the server to filter out broken streams, and reports plays back so the community's popularity ranking stays useful. The mirror is found over DNS, falling back to de1.api.radio-browser.info.

Browsing by genre lists the 100 tags with the most stations and matches the one you pick exactly, so "rock" does not also bring in "80s rock" or "rockabilly". A typed search matches tags loosely, which suits a search. Each list shows up to 60 stations, most played first.

Small terminals

Below 68 columns the metadata pane is dropped and the station list takes the full width; below 20 rows the signal meter goes too. The list and the controls are what the app cannot do without, so they are what survive.

Development

uv sync
uv run pytest
uv run ruff check .

The entry point also provides a headless harness for testing streams:

uv run pyode --volume 65 --name "Smooth Jazz" --play <stream-url>
uv run pyode --silent --seconds 10 --play <stream-url>   # decode without an audio device

Build and check an installed release (requires network access for dependencies):

uv build --out-dir dist/0.7.0-radio
uv run python scripts/check_install.py dist/0.7.0-radio

See the release procedure for PyPI setup and publishing.

Licence

pyode is licensed under the GNU General Public License, version 2 or later. See LICENSE.

It plays audio through libmpv via python-mpv, which inherits libmpv's licence — GPLv2-or-later on a stock build, LGPLv2.1-or-later if libmpv was built that way. The remaining dependencies (Textual, httpx, platformdirs) are MIT or BSD.

Metadata

Release files for pyode-radio 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyode-radio 0.7.0
File Size Uploaded Provenance Actions
pyode_radio-0.7.0.tar.gz 78.2 kB Without provenance Details for pyode_radio-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyode-radio 0.7.0
File Interpreter ABI Platform Actions
pyode_radio-0.7.0-py3-none-any.whl Python 3 none any Details for pyode_radio-0.7.0-py3-none-any.whl

Total release size: 158.3 kB

Release files / pyode_radio-0.7.0.tar.gz

Download URL pyode_radio-0.7.0.tar.gz
Size 78.2 kB
Tags Source
SHA-256 checksum
How to use checksums
43105b1273fd73f074bc1ede7ba60af46615bd250a51b9f4e57dcdddbb475dd5
BLAKE2b-256 checksum
How to use checksums
f035f290cdceda49f7d9ebb242fe4293364ab25e2ac64820a15057b120d41a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyode_radio-0.7.0-py3-none-any.whl

Download URL pyode_radio-0.7.0-py3-none-any.whl
Size 80.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5731ec0643c23e58b192a83575b11aadcb59381c0a126a721c26eb368c222fc0
BLAKE2b-256 checksum
How to use checksums
6d9dc05b0282f89d8458ec4d55cc87e89e0ee3c86278556d7b11252e7ed63c3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pyode-radio 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page