playlist

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package playlist contains the default playlist implementation.

FilePlaylistFactory

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>
        }
    ]
}

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 file path is a physical file reachable by the server process. The file ending determines the content type which is send to the client.

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

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) (*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.

Jump to

Keyboard shortcuts

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