From 02c5dd0b09c506bacb31c70b385d5d2965ff8ae1 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sat, 6 Jun 2026 09:20:18 +0100 Subject: [PATCH] docs(readme): overhaul for v2.0 TUI, installers, and CLI Update documentation to cover the new Bubble Tea TUI, one-liner installers (Linux/macOS/Windows), CLI subcommands (find/play/fav), playback view, configuration, and development/release workflow. Remove outdated build steps, legacy examples, and old TODO list. --- README.md | 268 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 141 insertions(+), 127 deletions(-) diff --git a/README.md b/README.md index e5400a1..576c8db 100644 --- a/README.md +++ b/README.md @@ -12,143 +12,157 @@ This is a port of a Python script I wrote, called "radiostations". It is a simple console tool to grab a list of radio stations retrieved from `radio-browser.info`, put them into a menu, and then use your local installation of a console stream player, to play the station for you. -### Requirements -* OS: Linux or macOS -* the `mpv` player (or `mpg123` or `mplayer`, if you change the config) -* Go 1.14+ (if you build your own binary) +## Requirements +* OS: Linux or macOS (Windows via the installers or WSL) +* Recommended player: `mpv` (with `--no-video`). Alternatives (`mpg123`, `mplayer`, etc.) can be configured in the ini file. +* For building from source: Go 1.24.2+ -### Build -1. clone the repository -2. cd into the root of the project -3. run the following: -``` -> go mod vendor -> go mod tidy -> go build -o /wherever/you/want/gostations github.com/gmgauthier/gostations +## Install (for normal users) + +The easiest way is the one-liner installer attached to each release: + +### Linux / macOS +```bash +curl -L https://repos.gmgauthier.com/gmgauthier/gostations/releases/download/v2.0.1/gostations-install.sh \ + | VERSION=2.0.1 bash ``` -### Install -1. copy `gostations` to a location that is on your `PATH` -2. copy `radiostations.ini` to a location that is on your `XDG_CONFIG_HOME` - * Note: if you skip step 2, the app will build an ini file for you automatically. - -### Execute +### Windows (PowerShell) / macOS / Linux with PowerShell +```powershell +irm https://repos.gmgauthier.com/gmgauthier/gostations/releases/download/v2.0.1/gostations-install.ps1 | iex ``` -> gostations -h -Usage: - gostations [-n "name"] [-c "home country"] [-s "home state"] [-t "ordered,tag,list"] [-x] - -c string - Home country. - -n string - Station name (or identifier). - -s string - Home state (if in the United States). - -t string - Tag (or comma-separated tag list) - -x If toggled, will show stations that are down - -h (or none) - This help message -``` -### Examples -``` -greg.gauthier@C02DRPKUMD6M $ gostations -c "United Kingdom" -t "news" -n "LBC" -...Radio Menu... -1) LBC London (London stream) AAC AAC+ 0 http://media-sov.musicradio.com:80/LBCLondon -2) LBC London (London stream) MP3 MP3 48 http://media-ice.musicradio.com/LBCLondonMP3Low -3) LBC London (National stream) MP3 48 http://media-ice.musicradio.com/LBCUKMP3Low -4) LBC London News AAC 48 http://media-ice.musicradio.com/LBC1152.m3u -5) LBC UK AAC 48 http://media-ice.musicradio.com/LBCUK -6) *Quit -What is your choice? -``` -``` -greg.gauthier@C02DRPKUMD6M $ gostations -c "Gambia" -...Radio Menu... -1) Choice FM MP3 128 http://uk3-pn.webcast-server.net/8276/stream.mp3 -2) *Quit -What is your choice? -``` -``` -greg.gauthier@C02DRPKUMD6M $ gostations -t "chicago,classical" -...Radio Menu... -1) WFMT 98.7 Chicago, IL (MP3) MP3 0 http://stream.wfmt.com/main-mp3 -2) *Quit -What is your choice? -``` -When you want to play, you just choose an entry from the menu and hit enter. Your selected stream player will begin playing, and its output will be seen on the console: -``` -greg.gauthier@C02DRPKUMD6M $ gostations -s "Illinois" -t "classical" -...Radio Menu... -1) Ancient Faith Radio AAC+ 96 https://ancientfaith.streamguys1.com/music -2) Lutheran Public Radio - Collinsville, IL AAC+ 0 http://lpr.streamguys1.com/lpr-aac -3) Majesty Radio MP3 128 http://primary.moodyradiostream.org/majesty.mp3 -4) WFMT 98.7 Chicago, IL (AAC) AAC 256 http://wowza.wfmt.com/live/smil:wfmt.smil/playlist.m3u8 -5) WFMT 98.7 Chicago, IL (MP3) MP3 0 http://stream.wfmt.com/main-mp3 -6) WNIU 90.5 Northern Public Radio Classica MP3 128 http://peace.str3am.com:6840/live-128k.mp3 -7) WUIS-HD2 NPR Illinois Classic - Springfi MP3 96 http://war.str3am.com:7780/WUISRIS-2 -8) WVIK MP3 0 https://wvik.streamguys1.com//live.mp3 -9) *Quit -What is your choice? -5 -Streaming: WFMT 98.7 Chicago, IL (MP3) MP3 0 http://stream.wfmt.com/main-mp3 - (+) Audio --aid=1 (mp3 2ch 44100Hz) -AO: [coreaudio] 44100Hz stereo 2ch floatp -A: 00:00:00 / 00:00:06 (14%) Cache: 5.5s/195KB -File tags: - icy-title: Steiner - Treasure of the Sierra Madre (1948) - - - Centaur -A: 00:00:23 / 00:00:46 (49%) Cache: 23s/825KB -``` -**NOTE:** If you are using `mpv` and you are on a Mac with a touchbar, and Catalina or better, you will see this error message: -``` -2021-03-17 10:51:41.328 mpv[40610:6351061] This NSLayoutConstraint is being configured with a constant that exceeds -internal limits. A smaller value will be substituted, but this problem should be fixed. Break -on BOOL _NSLayoutConstraintNumberExceedsLimit(void) to debug. This will be logged only once. This may break in the future. -``` -This is due to an issue between `mpv` and Apple at the moment, regarding the creation of `mpv` touchbar controls, and can be ignored. -While you are listening, all the normal stdin controls for `mpv` should work properly. So, `9` will lover the volume, `0` will raise the volume, and `m` will mute. To quit, type `q`. When you do, you'll automatically be delivered back to your original menu: +The installer: +- Detects your OS and architecture. +- Downloads the matching `gostations-OS-ARCH-vX.Y.Z.tar.gz` (verifies checksum when possible). +- Installs the binary to `~/.local/bin/gostations` (`.exe` on Windows). +- Prints `PATH` advice if needed and runs `gostations -v`. + +After installation, just run `gostations`. On first launch it creates a default `radiostations.ini` under `$XDG_CONFIG_HOME/gostations/` (usually `~/.config/gostations/radiostations.ini`) if none exists. + +## Usage + +### TUI (default) +`gostations` (no arguments) launches the modern Bubble Tea UI: + +- If you have any **favorites**, they are loaded first as the initial list (title: "Your Favorites"; entries marked ★). +- Otherwise a broad default search is performed against radio-browser.info (title includes "new TUI • ★ = favorite"). +- Type to filter the visible list (filter activates automatically). +- While filtering, press **Enter** to perform a fresh server-side search (replaces the list; favorites still get ★). +- **f** / **F** — toggle favorite (★) on the selected station. +- Arrow keys / vim keys — navigate. +- **Enter** on a station — switch to the dedicated playback view. +- **q** or **Ctrl+C** — quit. + +### Playback View +A compact, Winamp-inspired screen: +- Large "NOW PLAYING" viewer area (dark background + green text) showing live streamed metadata (station + song titles delivered over mpv JSON IPC). +- A vertical volume bar to the right of the metadata (dark gray background, green fill from the bottom; same height as the viewer; small gap). +- Keyboard-driven on-screen controls: + - `←` / `→` (or `h`/`l`) — skip back/forward. + - `↑` / `↓` — volume up/down. + - `m` / `M` — mute / unmute. + - `Space` or `p` / `P` — play / pause. + - `s` / `S` / `x` / `X` — stop playback and return to the station list. +- `q` quits the whole app. + +Playback runs in the background; the TUI stays responsive. + +### CLI subcommands (scripting) ``` - (+) Audio --aid=1 (mp3 2ch 44100Hz) -AO: [coreaudio] 44100Hz stereo 2ch floatp -A: 00:00:00 / 00:00:06 (14%) Cache: 5.5s/195KB -File tags: - icy-title: Steiner - Treasure of the Sierra Madre (1948) - - - Centaur - -A: 00:05:52 / 00:06:16 (94%) Cache: 23s/824KB -File tags: - icy-title: Korngold, Erich Wolfgang - The Sea Wolf film music - - - Koch -A: 00:07:42 / 00:08:06 (95%) Cache: 23s/827KB - -Exiting... (Quit) -[] -1) Ancient Faith Radio AAC+ 96 https://ancientfaith.streamguys1.com/music -2) Lutheran Public Radio - Collinsville, IL AAC+ 0 http://lpr.streamguys1.com/lpr-aac -3) Majesty Radio MP3 128 http://primary.moodyradiostream.org/majesty.mp3 -4) WFMT 98.7 Chicago, IL (AAC) AAC 256 http://wowza.wfmt.com/live/smil:wfmt.smil/playlist.m3u8 -5) WFMT 98.7 Chicago, IL (MP3) MP3 0 http://stream.wfmt.com/main-mp3 -6) WNIU 90.5 Northern Public Radio Classica MP3 128 http://peace.str3am.com:6840/live-128k.mp3 -7) WUIS-HD2 NPR Illinois Classic - Springfi MP3 96 http://war.str3am.com:7780/WUISRIS-2 -8) WVIK MP3 0 https://wvik.streamguys1.com//live.mp3 -9) *Quit -What is your choice? +gostations find [-n name] [-c country] [-s state] [-t tags] [-x] [-j] +gostations play [-n name] [-c country] [-s state] [-t tags] [-x] [url] +gostations fav list | add | del ... +gostations -v +gostations --legacy # force the classic wmenu UI (temporary) ``` -To exit the program entirely, choose the __*Quit__ option, or just hit `[ENTER]` -### Additional Notes: +Global search flags (`-n`/`-c`/`-s`/`-t`/`-x`) are accepted by `find`, `play`, and `fav add|del`. -1. The ini file sets a bunch of environmental defaults necessary for the program to work. Gostations looks for it on your `XDG_CONFIG_HOME` path. If that path is not set, or the file is not found on the path, a default version of the ini will be generated automatically, called `radiostations.ini`. The default location for the `XDG_CONFIG_HOME` is `$HOME/.config/gostations`, if you need to edit it. -2. One of the defaults set in that ini file, is a limit on the number of entries that the program will retrieve from the radio-browser.info api, and the number of entries that will be displayed in the menu. `gostations` isn't really designed to dump the entire radio-browser database to a menu. I've set the limit to 9999 by default, but it could probably be less. Tuning your searches should help improve the experience. -3. Speaking of that, there are a number of things to keep in mind when searching: - * The country search is by country NAME, not CODE. So, "United States" will work, but "US" will not (likewise for "UK") - * if you supply multiple tags in a comma-separated list, you may unintentionally filter out results. Unfortunately, the api at radio-info is such that the tag list you search for, has to be in precisely the order it is returned from the host. So, for example, if you search for "classical,chicago", your search will filter out WFMT, because their tags are "chicago,classical". - * It seems many of the stations put their city in the tag list. So, you can reduce the size of your results by doing something like this: `-c "United States" -t "atlanta"`, which makes more sense for radio stations anyway, for radio stations. - -### TODO +- `find` — search and print results (`-j`/`--json` for machine-readable). +- `play` — play the first match (or a direct URL). Uses the player + options from the ini. +- `fav list` — show your favorites (1-based index, stable sort by name). +- `fav add` — add by search flags or direct URL. +- `fav del` — remove by 1-based index (from `fav list`), search flags, or direct URL. -* Change the precheck, to do ini file validation once, rather than every time a config value is called for. -* Add a way to capture favorite selections. Perhaps a preloaded search or something. -* Add color or a dashboard to the menu and player. +Examples: +```bash +gostations find -c "United Kingdom" -t "news" -j +gostations play -c Gambia +gostations play http://stream.example.com/radio.mp3 +gostations fav list +gostations fav add -n "WFMT" +gostations fav del 3 +gostations fav del http://... +``` +Run `gostations -h` or `gostations -h` for full flag details. -. +### Legacy UI +Pass `--legacy` to use the old wmenu-based menu. The flag exists "until the new TUI is perfect." Playback now uses the modern player backend even under `--legacy`. +## Configuration + +The ini file is at `$XDG_CONFIG_HOME/gostations/radiostations.ini` (falls back to `~/.config/gostations/radiostations.ini`). A default is generated on first run if missing. + +Notable keys: +- `player.command=mpv` +- `player.options=--no-video` +- `radio_browser.api=...` (point at a mirror if desired) +- `menu_items.max=9999` + +Favorites are stored as JSON (`favorites.json`) in the same directory. The TUI prefers loading favorites first when any exist. + +## Develop (for power users & developers) + +### Prerequisites +- Go 1.24.2+ +- `make` (recommended) +- `mpv` (for local playback testing) +- Optional: `golangci-lint` for `make lint` + +### Common tasks +```bash +git clone https://repos.gmgauthier.com/gmgauthier/gostations.git +cd gostations + +make help # list all targets +make build # dev build (version from git describe, ldflags into internal/version + main.version) +make install # build + copy to ~/.local/bin/gostations +make test-short # fast unit tests (no network, no player required) +make test # full suite with -race +make test-cover # coverage report in build/ +make lint +make cross # release matrix (linux/amd64+arm64, darwin/amd64+arm64, windows/amd64) +``` + +See the `Makefile` for the exact ldflags, per-platform `go mod download`, and the `release-notes` helper. + +### Releasing +```bash +./release.sh v2.0.2 +# or manually +git tag -a v2.0.2 -m "..." +git push origin v2.0.2 +``` + +`release.sh` does a clean-tree check, creates the annotated tag, optionally runs `grokkit changelog` (best-effort), and pushes. The Gitea Actions workflow (`.gitea/workflows/release.yml`) then: +- Checks out the tag. +- Sets up Go 1.24.2 + module cache. +- Runs `go mod tidy` + `make cross`. +- Packages tarballs + checksums + the two install scripts. +- Creates the release (with install instructions in the body) and uploads every asset via the Gitea API using the `RELEASE_TOKEN` secret. + +### Project layout (post-reorg) +- `internal/ui/` — Bubble Tea TUI (list + playback view + hint bar + volume bar + polling). +- `internal/player/` — `Player` interface + `mpvPlayer` (JSON IPC via unix socket) + legacy exec fallback. +- `internal/data/` — favorites (JSON, atomic save, sorted list with stable indices). +- `internal/radio/`, `internal/config/` — search + ini handling. +- Legacy wmenu code (`radiomenu.go`, `commander.go`, etc.) remains gated behind `--legacy`. +- `scripts/` — installers (`.sh` + `.ps1`). +- `.gitea/workflows/` — build + release CI. +- `Makefile` + `release.sh` drive local builds and the tag-triggered release path. + +The project is WOMM Platinum certified (see badge at the top). + +All the pre-2.0 wmenu screenshots, the old `go mod vendor` instructions, the touchbar error note, and the ancient TODO list have been retired from this document. See git history for the full modernization (TUI, IPC player, favorites + index delete, subcommands, internal/ package reorg, CI/release pipeline, etc.). The `--legacy` flag remains until the TUI is declared "perfect."