A dead simple Icecast transmission library for Go, with support for in-band metadata.
- Go 100%
| internal/icy | ||
| go.mod | ||
| go.sum | ||
| icy.go | ||
| LICENSE | ||
| README.md | ||
icy
A dead simple Icecast transmission library for Go, with support for in-band
metadata.
Icy will figure out the song's title from id3v2 tags in MP3s, or use the
filename as a fallback. This behaviour can be changed with SetTitleHandler.
Icy supports whatever input files ffmpeg can transcode. Incidentally, ffmpeg has to be available on the system path for it to work. The original solution decoded MP3 files using a pure Go library, but it didn't work very well.
Icy uses ffmpeg to transcode all input files into a 44.1kHz/192kb double channel MPEG stream.
Installation
go get flipfloppy.io/icy
API
See the pkgsite documentation.
Examples
// shuffle on all MP3 files in every subdirectory of mysongs
icy.Shuffle("./mysongs/*/*.mp3", icy.RadioDetails{})
// play all M4A files in the current directory in order
icy.Play("*.m4a", icy.RadioDetails{})
// shuffle all FLAC files in the current directory on every day except Tuesday.
// On Tuesdays, play WAV files from "special songs" that begin with "tue".
icy.Shuffle("*.flac", icy.RadioDetails{
Schedule: map[string]string{"Tuesday": "./special songs/tue*.wav"},
})
// shuffle on all Ogg Vorbis files in the current directory,
// except on the 22nd of every month. On the 22nd between 2-3AM/PM,
// play from the "nyan nyan" directory.
icy.Shuffle("*.ogg", icy.RadioDetails{
Schedule: map[string]string{"22 2:00-2:59 2pm-3pm": "./nyan nyan/*.mp3"},
})
// play all MP3s in the current directory on every day apart from christmas.
// play MP3s in "christmas songs" on christmas.
icy.Play("*.mp3", icy.RadioDetails{
Schedule: map[string]string{"December 25": "./christmas songs/*.mp3"},
})