Documentation ¶
Index ¶
- Variables
- func CommandListEqual(a, b *CommandList) bool
- type AckError
- type Client
- func (c *Client) AlbumArt(ctx context.Context, uri string) ([]byte, error)
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) Commands(ctx context.Context) ([]string, error)
- func (c *Client) Config(ctx context.Context) (map[string]string, error)
- func (c *Client) Consume(ctx context.Context, state bool) error
- func (c *Client) Crossfade(ctx context.Context, t time.Duration) error
- func (c *Client) CurrentSong(ctx context.Context) (map[string][]string, error)
- func (c *Client) DisableOutput(ctx context.Context, id string) error
- func (c *Client) EnableOutput(ctx context.Context, id string) error
- func (c *Client) ExecCommandList(ctx context.Context, cl *CommandList) error
- func (c *Client) ListAllInfo(ctx context.Context, uri string) ([]map[string][]string, error)
- func (c *Client) ListMounts(ctx context.Context) ([]map[string]string, error)
- func (c *Client) ListNeighbors(ctx context.Context) ([]map[string]string, error)
- func (c *Client) Mount(ctx context.Context, path, url string) error
- func (c *Client) Next(ctx context.Context) error
- func (c *Client) OneShot(ctx context.Context) error
- func (c *Client) OutputSet(ctx context.Context, id, name, value string) error
- func (c *Client) Outputs(ctx context.Context) ([]*Output, error)
- func (c *Client) Pause(ctx context.Context, state bool) error
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Play(ctx context.Context, pos int) error
- func (c *Client) PlaylistInfo(ctx context.Context) ([]map[string][]string, error)
- func (c *Client) Previous(ctx context.Context) error
- func (c *Client) Random(ctx context.Context, state bool) error
- func (c *Client) ReadPicture(ctx context.Context, uri string) ([]byte, error)
- func (c *Client) Repeat(ctx context.Context, state bool) error
- func (c *Client) ReplayGainMode(ctx context.Context, mode string) error
- func (c *Client) ReplayGainStatus(ctx context.Context) (map[string]string, error)
- func (c *Client) SeekCur(ctx context.Context, t float64) error
- func (c *Client) SetVol(ctx context.Context, vol int) error
- func (c *Client) Single(ctx context.Context, state bool) error
- func (c *Client) Stats(ctx context.Context) (map[string]string, error)
- func (c *Client) Status(ctx context.Context) (map[string]string, error)
- func (c *Client) Unmount(ctx context.Context, path string) error
- func (c *Client) Update(ctx context.Context, uri string) (map[string]string, error)
- func (c *Client) Version() string
- type ClientOptions
- type CommandError
- type CommandList
- type Config
- type ConfigAudioOutput
- type Output
- type Watcher
- type WatcherOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrParse = errors.New("parse error") ErrParseNoStartResponse = fmt.Errorf("%w: no start response", ErrParse) ErrParseNoEndResponse = fmt.Errorf("%w: no end response", ErrParse) ErrParseNoKey = fmt.Errorf("%w: no key and colon", ErrParse) )
parser errors.
var ( // ErrClosed is returned when connection is closed by client. ErrClosed = errors.New("mpd: connection closed") )
Functions ¶
func CommandListEqual ¶ added in v0.12.0
func CommandListEqual(a, b *CommandList) bool
CommandListEqual compares command list a and b.
Types ¶
type AckError ¶ added in v0.10.3
type AckError int
AckError is the numeric value in CommandError.
const ( ErrNotList AckError = 1 ErrArg AckError = 2 ErrPassword AckError = 3 ErrPermission AckError = 4 ErrUnknown AckError = 5 ErrNoExist AckError = 50 ErrPlaylistMax AckError = 51 ErrSystem AckError = 52 ErrPlaylistLoad AckError = 53 ErrUpdateAlready AckError = 54 ErrPlayerSync AckError = 55 ErrExist AckError = 56 )
Predefined error codes in https://github.com/MusicPlayerDaemon/MPD/blob/master/src/protocol/Ack.hxx
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a mpd client.
func Dial ¶ added in v0.11.0
func Dial(proto, addr string, opts *ClientOptions) (*Client, error)
Dial connects to mpd server.
func (*Client) Commands ¶ added in v0.8.0
Commands returns which commands the current user has access to.
func (*Client) Config ¶
Config dumps configuration values that may be interesting for the client. This command is only permitted to “local” clients (connected via local socket).
func (*Client) CurrentSong ¶
CurrentSong displays the song info of the current song
func (*Client) DisableOutput ¶
DisableOutput turns an output off.
func (*Client) EnableOutput ¶
EnableOutput turns an output on.
func (*Client) ExecCommandList ¶ added in v0.8.0
func (c *Client) ExecCommandList(ctx context.Context, cl *CommandList) error
ExecCommandList executes commandlist.
func (*Client) ListAllInfo ¶
ListAllInfo lists all songs and directories in uri.
func (*Client) ListMounts ¶ added in v0.10.0
ListMounts queries a list of all mounts.
func (*Client) ListNeighbors ¶ added in v0.12.0
ListNeighbors queries a list of “neighbors” (e.g. accessible file servers on the local net).
func (*Client) PlaylistInfo ¶
PlaylistInfo displays a list of all songs in the playlist.
func (*Client) ReadPicture ¶ added in v0.11.0
ReadPicture locates picture for the given song. If song has no picture, returns nil, nil.
func (*Client) ReplayGainMode ¶ added in v0.8.0
ReplayGainMode sets the replay gain mode.
func (*Client) ReplayGainStatus ¶ added in v0.8.0
ReplayGainStatus prints replay gain options.
type ClientOptions ¶ added in v0.11.0
type ClientOptions struct { Password string // Timeout is the maximum amount of time a dial will wait for a connect to complete. Timeout time.Duration HealthCheckInterval time.Duration ReconnectionInterval time.Duration // BinaryLimit sets maximum binary response size. BinaryLimit int // CacheCommandsResult caches mpd command "commands" result CacheCommandsResult bool }
ClientOptions contains options for mpd client connection.
type CommandError ¶
CommandError represents mpd command error.
func (*CommandError) Error ¶
func (f *CommandError) Error() string
func (*CommandError) Is ¶ added in v0.10.3
func (f *CommandError) Is(target error) bool
Is returns true if pointer or all values are same.
func (*CommandError) Unwrap ¶ added in v0.10.3
func (f *CommandError) Unwrap() error
Unwrap returns AckError.
type CommandList ¶
type CommandList struct {
// contains filtered or unexported fields
}
CommandList represents Client commandlist.
func (*CommandList) Play ¶
func (cl *CommandList) Play(pos int)
Play begins playing the playlist at song number pos.
type Config ¶ added in v0.8.0
type Config struct { MusicDirectory string AudioOutputs []*ConfigAudioOutput }
Config represents MPD config struct
func ParseConfig ¶ added in v0.8.0
ParseConfig parses mpd.conf
type ConfigAudioOutput ¶ added in v0.8.0
ConfigAudioOutput represents MPD audio_output struct.
type Output ¶ added in v0.9.0
type Output struct { ID string Name string Enabled bool Plugin string Attributes map[string]string }
Output represents mpd output struct.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is the mpd idle command watcher.
func NewWatcher ¶ added in v0.11.0
func NewWatcher(proto, addr string, opts *WatcherOptions) (*Watcher, error)
NewWatcher connects to mpd server
type WatcherOptions ¶ added in v0.11.0
type WatcherOptions struct { Password string Timeout time.Duration ReconnectionInterval time.Duration // SubSystems are list of recieve events. Watcher recieves all events if SubSystems are empty. SubSystems []string }
WatcherOptions contains options for mpd idle command connection.