Add mp3 support + command line option to limit tracks + general redesign for more modularity

This commit is contained in:
r4
2021-06-21 20:37:22 +02:00
parent 42a2034341
commit 5dab3c4e96
6 changed files with 331 additions and 165 deletions

17
model/extractor.go Normal file
View File

@@ -0,0 +1,17 @@
package model
import (
"io"
)
type Extractor interface {
// Reads a single "block" from a radio stream. A block can be any chunk of
// data, depending on the file format, for example in Ogg/Vorbis it would
// be equivalent to a chunk. Writes the part containing the actual music
// data into `w`.
// `isFirst` is true, if the block read was the first block of a file.
ReadBlock(r io.Reader, w io.Writer) (isFirst bool, err error)
// Potentially returns a filename using format-specific metadata. Usually
// available after the first few blocks of a file were read.
TryGetFilename() (filename string, hasFilename bool)
}