Repository navigation
radio2 command line tool
This article explains part of Radio 2.0 in plain words. It is not normative: where it differs from the specification, the specification is right.
The radio2 command line tool checks Radio 2.0 documents and finds station manifests from a terminal. It has two commands: validate and discover. It is built on the Go Reference implementation.
| Install | go install github.com/Tend-Stack/radio2/cmd/radio2@latest |
| Commands |
radio2 validate, radio2 discover
|
| Exit codes | 0 pass, 1 fail, 2 usage or network error |
| Source | cmd/radio2/main.go |
| Status | Draft; released as v0.2.4-draft |
With Go:
go install github.com/Tend-Stack/radio2/cmd/radio2@latest
Without Go, download the archive for your system from the releases page, check it against SHA256SUMS, and optionally verify how it was built with gh attestation verify <archive> --repo Tend-Stack/radio2. radio2 version prints the tool version and the specification version it implements, for example radio2 v0.2.4-draft (spec 0.2).
radio2 validate [-dev] [-type manifest|event|schedule] <file|url>
radio2 discover [-dev] <homepage-or-stream-url>
radio2 version
validate takes a file or an https URL. By default it checks a manifest; -type event and -type schedule check the other documents. -dev selects the development tier, which allows http for development hosts. URLs are fetched with the section 10.2 limits.
discover takes a homepage or a stream URL. It finds the manifest, validates it, and reports whether it is verified.
| Code | Meaning |
|---|---|
| 0 | Pass |
| 1 | Fail |
| 2 | Usage error or network error |
For validate, a failed document exits with 1. For discover, an unverified manifest also exits with 1 in the run shown below.
These runs were made locally with a build of the tool, against files in the repository's examples/ and testdata/ folders and a local web server on the loopback address. No real station was contacted.
$ radio2 validate examples/manifest-minimal.json
WARNING /guid: this guid belongs to an example of the specification; a station must create its own (section 4.1) [example-guid]
PASS examples/manifest-minimal.json
The warning appears because the example uses a documentation guid. It does not fail the run (exit 0).
$ radio2 validate testdata/invalid/manifest--duplicate-stream-ids.json
ERROR /streams/1/id: stream id "main" is used more than once [unique-id]
WARNING /streams: 2 streams set default; only the first counts (section 2.4) [default-stream]
WARNING /guid: this guid belongs to an example of the specification; a station must create its own (section 4.1) [example-guid]
FAIL testdata/invalid/manifest--duplicate-stream-ids.json (1 errors)
That run exits with 1.
$ radio2 validate -type event examples/events/now_playing.json
PASS examples/events/now_playing.json
Discovery against a local development server serving a copy of the minimal example:
$ radio2 discover -dev http://localhost:18931/
manifest: http://localhost:18931/.well-known/radio-manifest.json
found via: well-known (http://localhost:18931/.well-known/radio-manifest.json)
station: Example Community Radio (guid 9b2f6c1e-4d3a-5b8e-9f10-2a6c7d8e9f01)
verified: no
- homepage does not use https
- manifestUrl does not use https
- development-tier manifest (section 10.2): never verified for a public listing
This exits with 1. Without -dev, the same command refuses the address and exits with 2:
radio2: development-tier address refused (section 10.2): localhost:18931
Because the exit code is 0, 1 or 2, a script or CI job can tell a failed manifest (1) from a mistake in the call or a network problem (2). Publishers can run validate on their own manifest URL before announcing it; the Stations page asks for this.
Radio 2.0 is an open standard, MIT licensed. Documentation: radio2.org. Questions: Discussions.
Overview
The manifest
Discovery and identity
Live data
Money
Implementations and tools
- Implementations
- Reference implementation
- radio2 command line tool
- Create a manifest
- Conformance
- Stations
- Brand and badges
Project
Documentation
Community