Compare commits
4 Commits
2021-07-02
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
263ccab062 | ||
783458aebc | |||
|
c00e2669ed | ||
|
f240fff54e |
14
README.md
14
README.md
@ -2,7 +2,19 @@
|
||||
|
||||
A program that extracts the individual tracks from an Ogg/Vorbis or mp3 radio stream. Written in go without any non-standard dependencies.
|
||||
|
||||
## Building
|
||||
## Obtaining the binary
|
||||
|
||||
### Via [releases](https://git.nobrain.org/r4/radio-stream-recorder/releases/latest)
|
||||
|
||||
- Download the binary for your system from https://git.nobrain.org/r4/radio-stream-recorder/releases/latest
|
||||
|
||||
- (__*nix only__) Make executable `chmod +x <EXECUTABLE PATH>`
|
||||
|
||||
- That should be it, just open a terminal and run it; see usage
|
||||
|
||||
### From source
|
||||
|
||||
- Clone the git repo and cd into it
|
||||
|
||||
- Install [go](https://golang.org/) (preferably a recent version)
|
||||
|
||||
|
11
mp3/mp3.go
11
mp3/mp3.go
@ -38,8 +38,8 @@ func NewExtractor(respHdr http.Header) (*Extractor, error) {
|
||||
func (d *Extractor) ReadBlock(r io.Reader, w io.Writer) (isFirst bool, err error) {
|
||||
var musicData bytes.Buffer
|
||||
|
||||
// We want to write everything to the output, as well as musicData for
|
||||
// calculating the checksum.
|
||||
// We want to write everything except the metadata to the output and to
|
||||
// musicData for calculating the checksum.
|
||||
multi := io.MultiWriter(w, &musicData)
|
||||
|
||||
// Read until the metadata chunk. The part that is read here is also what
|
||||
@ -57,8 +57,8 @@ func (d *Extractor) ReadBlock(r io.Reader, w io.Writer) (isFirst bool, err error
|
||||
// Read metadata blocks.
|
||||
if numBlocks > 0 {
|
||||
// Metadata is only actually stored in the first metadata chunk
|
||||
// of a given file. Therefore, every metadata chunk with more than 1
|
||||
// block always marks the beginning of a file.
|
||||
// of a given file. Therefore, every metadata chunk with more than 0
|
||||
// blocks always marks the beginning of a file.
|
||||
isBOF = true
|
||||
|
||||
// Each block is 16 bytes in size. Any excess bytes in the last block
|
||||
@ -84,8 +84,7 @@ func (d *Extractor) ReadBlock(r io.Reader, w io.Writer) (isFirst bool, err error
|
||||
t = t[1 : len(t)-1]
|
||||
if t == "Unknown" {
|
||||
// If there is no stream title, use format:
|
||||
// Unknown_<crc32 checksum>
|
||||
// Where the checksum is only that of the first block.
|
||||
// Unknown_<crc32 checksum of first block>
|
||||
sumStr := strconv.FormatInt(int64(crc32.ChecksumIEEE(musicData.Bytes())), 10)
|
||||
d.streamTitle = "Unknown_" + sumStr
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user