mpd

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements the MPD protocol

func NewClient

func NewClient(addr string) (*Client, error)

NewClient connects a client to the MPD server listening on tcp addr

func (*Client) ClearError

func (c *Client) ClearError() error

ClearError clears the current error message in status

func (*Client) Close

func (c *Client) Close() error

Close the connection with MPD

func (*Client) CurrentSong

func (c *Client) CurrentSong() (*CurrentSong, error)

CurrentSong displays the song info of the current song

func (*Client) Idle

func (c *Client) Idle(subsystems string) ([]string, error)

Idle waits until there is a noteworthy change in one or more of MPD’s subsystems While a client is waiting for idle results, the server disables timeouts, allowing a client to wait for events as long as mpd runs. Change events accumulate, even while the connection is not in “idle” mode, no events gets lost while the client is doing something else with the connection. If an event had already occurred since the last call, the new idle command will return immediately.

func (*Client) Load

func (c *Client) Load(name string) error

Load loads the playlist into the current queue Note: range [start:end] currently not supported

func (*Client) Next

func (c *Client) Next() error

Next plays next song in the playlist

func (*Client) NoIdle

func (c *Client) NoIdle() error

NoIdle cancels Idle Command (no other commands are allowed)

func (*Client) Pause

func (c *Client) Pause(pause bool) error

Pause toggles pause/resumes playing

func (*Client) Ping

func (c *Client) Ping() error

Ping does nothing but return “OK”

func (*Client) Play

func (c *Client) Play(songpos int) error

Play begins playing the playlist at song number songpos. If songpos equal -1, starts playing at the current position in the playlist: this is not documented in the protocol but successfully tested with MPD 0.19.0

func (*Client) PlayID

func (c *Client) PlayID(songid int) error

PlayID begins playing the playlist at song number songpos. If songpos equal -1, starts playing at the current position in the playlist: this is not documented in the protocol but successfully tested with MPD 0.19.0

func (*Client) Previous

func (c *Client) Previous() error

Previous plays previous song in the playlist

func (*Client) Request

func (c *Client) Request(format string, args ...interface{}) ([]string, error)

Request execute a MPD command

func (*Client) Stats

func (c *Client) Stats() (*Stats, error)

Stats displays server statistics

func (*Client) Status

func (c *Client) Status() (*Status, error)

Status reports the current status of the player and the volume level

func (*Client) Stop

func (c *Client) Stop() error

Stop stops playing

type CurrentSong

type CurrentSong struct {
	Album  string
	Artist string
	File   string
	ID     int
	Name   string
	Pos    int
	Time   int
	Title  string
}

CurrentSong contains the song info returned by CurrentSong()

type Stats

type Stats struct {
	Artists    int
	Albums     int
	DBplaytime int
	DBupdate   int
	Playtime   int
	Songs      int
	Uptime     int
}

Stats contains server statistics returned by Stats()

type Status

type Status struct {
	Audio          string
	Bitrate        int
	Duration       int
	Elapsed        float64
	Error          string
	Playlist       int
	PlaylistLength int
	Song           int
	Songid         int
	State          string
}

Status contains current status of the player returned by Status() Note: some fields returned by MPD are ignored

Jump to

Keyboard shortcuts

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