Documentation ¶
Index ¶
- Constants
- func InitLoggers(factory func(prefix string) *log.Logger)
- type Channel
- type ChunkBufferStreamer
- func (cb *ChunkBufferStreamer) Close() error
- func (cb *ChunkBufferStreamer) Length() int
- func (cb *ChunkBufferStreamer) Position() int
- func (cb *ChunkBufferStreamer) RequestChunkAtOffset(offset int) io.ReadCloser
- func (cb *ChunkBufferStreamer) RequestSampleRange(start, end int) (io.ReadCloser, *http.Response)
- func (cb *ChunkBufferStreamer) Seek(p int) error
- func (cb *ChunkBufferStreamer) Stream(samples [][2]float64) (int, bool)
- type ClientStreamer
- func (client *ClientStreamer) Close() error
- func (client *ClientStreamer) Err() error
- func (client *ClientStreamer) Len() int
- func (client *ClientStreamer) Position() int
- func (client *ClientStreamer) Seek(p int) error
- func (client *ClientStreamer) Stream(samples [][2]float64) (n int, ok bool)
- func (client *ClientStreamer) String() string
- type Decoder
- type DownloadClient
- type Enclosure
- type FeedCache
- type Item
- type RSSFeed
- type SizedResult
Constants ¶
const ( RSSLog = "RssClient" DLLog = "Downloader" TCPALog = "TCPAudio" )
Variables ¶
This section is empty.
Functions ¶
func InitLoggers ¶
InitLoggers should be called by the bootstrapping application to assign log.Logger instances to the various clients
Types ¶
type Channel ¶
type Channel struct { XMLName xml.Name `xml:"channel"` Item []Item `xml:"item"` Generator string `xml:"generator"` Title string `xml:"title"` Description string `xml:"description"` Language string `xml:"language"` PubDate string `xml:"pubDate"` }
Channel data represents an entire podcast.
type ChunkBufferStreamer ¶
type ChunkBufferStreamer struct { beep.StreamSeekCloser Episode string // contains filtered or unexported fields }
func NewChunkBufferStreamer ¶
func NewChunkBufferStreamer(url string) (*ChunkBufferStreamer, beep.Format)
func (*ChunkBufferStreamer) Close ¶
func (cb *ChunkBufferStreamer) Close() error
func (*ChunkBufferStreamer) Length ¶
func (cb *ChunkBufferStreamer) Length() int
func (*ChunkBufferStreamer) Position ¶
func (cb *ChunkBufferStreamer) Position() int
func (*ChunkBufferStreamer) RequestChunkAtOffset ¶
func (cb *ChunkBufferStreamer) RequestChunkAtOffset(offset int) io.ReadCloser
func (*ChunkBufferStreamer) RequestSampleRange ¶
func (cb *ChunkBufferStreamer) RequestSampleRange(start, end int) (io.ReadCloser, *http.Response)
func (*ChunkBufferStreamer) Seek ¶
func (cb *ChunkBufferStreamer) Seek(p int) error
type ClientStreamer ¶
func StreamDecode ¶
func StreamDecode(audio io.ReadCloser) (*ClientStreamer, beep.Format, error)
StreamDecode is replicating the interface of mp3.Decode returning a buffer instead of a reader. It acts as a wrapper to asynchronously buffer the tcp audio stream.
func (*ClientStreamer) Close ¶
func (client *ClientStreamer) Close() error
func (*ClientStreamer) Err ¶
func (client *ClientStreamer) Err() error
func (*ClientStreamer) Len ¶
func (client *ClientStreamer) Len() int
func (*ClientStreamer) Position ¶
func (client *ClientStreamer) Position() int
func (*ClientStreamer) Seek ¶
func (client *ClientStreamer) Seek(p int) error
func (*ClientStreamer) Stream ¶
func (client *ClientStreamer) Stream(samples [][2]float64) (n int, ok bool)
func (*ClientStreamer) String ¶
func (client *ClientStreamer) String() string
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is a ripoff of the streamer that mp3.Decode returns but with a Decoder.SetLength. All the methods are identical except the Decoder.SetLength.
func TcpDiskBufferedStreamer ¶
func TcpDiskBufferedStreamer(url string, logger *log.Logger, cachePath string) (streamer *Decoder, format beep.Format)
TcpDiskBufferedStreamer is basically a proxy to some hacked together beep source code, all credit to them, unless the code looks a bit messy, that's probably us.
type DownloadClient ¶
type DownloadClient struct {
Client *grab.Client
}
func NewClient ¶
func NewClient() *DownloadClient
func (*DownloadClient) CreateRequests ¶
func (c *DownloadClient) CreateRequests(urls []string) (reqs []*grab.Request)
func (*DownloadClient) DownloadEpisode ¶
func (c *DownloadClient) DownloadEpisode(req *grab.Request)
func (*DownloadClient) DownloadMulti ¶
func (c *DownloadClient) DownloadMulti(urls ...string)
type Item ¶
type Item struct { XMLName xml.Name `xml:"item"` Title string `xml:"title"` Description string `xml:"description"` PubDate string `xml:"pubDate"` Author string `xml:"author"` Link string `xml:"link"` Enclosure Enclosure `xml:"enclosure"` }
Item contains data for individual episodes.
type RSSFeed ¶
Defining Structs to parse clients Feed xml from HTTP request. The full feed including header.
func GetContent ¶
GetContent retrieves a clients Feed via HTTP Request. Parse the xml in the response into structs. Exit & Print in the event of an error.
func (*RSSFeed) EpisodeData ¶
EpisodeData iterates over Item structs within the Channel struct. Print some episode information to the terminal.
type SizedResult ¶
SizedResult is the struct that encapsulates the error on failure or the size, either predicted or written to disk, of the corresponding data in bytes
func Fail ¶
func Fail(failure error) *SizedResult
Fail is the named constructor for the case that the copy to disk fails
func Success ¶
func Success(size int64) *SizedResult
Success is the named constructor for the case that the download completes successfully
func (*SizedResult) IsSuccess ¶
func (r *SizedResult) IsSuccess() bool
IsSuccess returns true if the SizedResult.Err is not nil, i.e. a return value of true corresponds to the file being successfully downloaded