v1.3.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2019 License: MIT Imports: 14 Imported by: 0



Package playlist contains the default playlist implementation.


FilePlaylistFactory is a PlaylistFactory which reads its definition from a file. The definition file is expected to be a JSON encoded datastructure of the form:

    <web path> : [
            "artist" : <artist>
            "title"  : <title>
            "path"   : <file path / url>

The web path is the absolute path which may be requested by the streaming client (e.g. /foo/bar would be http://myserver:1234/foo/bar). The path is either a physical file or a web url reachable by the server process. The file ending determines the content type which is send to the client.



This section is empty.


View Source
var FileExtContentTypes = map[string]string{
	".mp3":  "audio/mpeg",
	".flac": "audio/flac",
	".aac":  "audio/x-aac",
	".mp4a": "audio/mp4",
	".mp4":  "video/mp4",
	".nsv":  "video/nsv",
	".ogg":  "audio/ogg",
	".spx":  "audio/ogg",
	".opus": "audio/ogg",
	".oga":  "audio/ogg",
	".ogv":  "video/ogg",
	".weba": "audio/webm",
	".webm": "video/webm",
	".axa":  "audio/annodex",
	".axv":  "video/annodex",

FileExtContentTypes maps file extensions to content types

View Source
var FrameSize = dudeldu.FrameSize

FrameSize is the frame size which is used by the playlists


This section is empty.


type FilePlaylist

type FilePlaylist struct {
	// contains filtered or unexported fields

FilePlaylist data structure

func (*FilePlaylist) Artist

func (fp *FilePlaylist) Artist() string

Artist returns the artist which is currently playing.

func (*FilePlaylist) Close

func (fp *FilePlaylist) Close() error

Close any open files by this playlist and reset the current pointer. After this call the playlist can be played again.

func (*FilePlaylist) ContentType

func (fp *FilePlaylist) ContentType() string

ContentType returns the content type of this playlist e.g. audio/mpeg.

func (*FilePlaylist) Finished

func (fp *FilePlaylist) Finished() bool

Finished returns if the playlist has finished playing.

func (*FilePlaylist) Frame

func (fp *FilePlaylist) Frame() ([]byte, error)

Frame returns the current audio frame which is playing.

func (*FilePlaylist) Name

func (fp *FilePlaylist) Name() string

Name is the name of the playlist.

func (*FilePlaylist) ReleaseFrame

func (fp *FilePlaylist) ReleaseFrame(frame []byte)

ReleaseFrame releases a frame which has been written to the client.

func (*FilePlaylist) Title

func (fp *FilePlaylist) Title() string

Title returns the title which is currently playing.

type FilePlaylistFactory

type FilePlaylistFactory struct {
	// contains filtered or unexported fields

FilePlaylistFactory data structure

func NewFilePlaylistFactory

func NewFilePlaylistFactory(path string, itemPathPrefix string) (*FilePlaylistFactory, error)

NewFilePlaylistFactory creates a new FilePlaylistFactory from a given definition file.

func (*FilePlaylistFactory) Playlist

func (fp *FilePlaylistFactory) Playlist(path string, shuffle bool) dudeldu.Playlist

Playlist returns a playlist for a given path.

type StreamBuffer added in v1.2.0

type StreamBuffer struct {
	bytes.Buffer // Buffer which is used to hold the data
	// contains filtered or unexported fields

StreamBuffer is a buffer which implements io.ReadCloser and can be used to stream one stream into another. The buffer detects a potential underflow and waits until enough bytes were read from the source stream.

func (*StreamBuffer) Close added in v1.2.0

func (b *StreamBuffer) Close() error

Close does nothing but must be there to implement io.ReadCloser.

func (*StreamBuffer) Read added in v1.2.0

func (b *StreamBuffer) Read(p []byte) (int, error)

func (*StreamBuffer) ReadFrom added in v1.2.0

func (b *StreamBuffer) ReadFrom(r io.Reader) (int64, error)

ReadFrom reads the source stream into the buffer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL