Documentation ¶
Index ¶
- Constants
- func StateToUnicode(state string) string
- type Client
- func (cl *Client) ActiveOutput() (string, error)
- func (cl *Client) Close() error
- func (cl *Client) CurrentState() string
- func (cl *Client) EnableRandom(enable bool) error
- func (cl *Client) IsRandom() bool
- func (cl *Client) ListPlaylists() []string
- func (cl *Client) LoadAndPlayPlaylist(name string) error
- func (cl *Client) Next() error
- func (cl *Client) Outputs() ([]string, error)
- func (cl *Client) Pause() error
- func (cl *Client) Play() error
- func (cl *Client) Prev() error
- func (cl *Client) Register(signal string, action func())
- func (cl *Client) Run()
- func (cl *Client) Stop() error
- func (cl *Client) SwitchToOutput(enableMe string) error
- func (cl *Client) TogglePlayback() error
- type Config
- type ReMPD
- type ReWatcher
Constants ¶
const ( // PlaybackStop means that there is no current song. PlaybackStop = "stop" // PlaybackPlay means that there is a current song in progress. PlaybackPlay = "play" // PlaybackPause means that there is a current song, but no progress. PlaybackPause = "pause" )
Variables ¶
This section is empty.
Functions ¶
func StateToUnicode ¶
StateToUnicode converts `state` into a nicer unicode glyph.
Types ¶
type Client ¶
type Client struct { sync.Mutex Config *Config MPD *ReMPD LW *display.LineWriter Status mpd.Attrs CurrSong mpd.Attrs Playlists []string Callbacks map[string][]func() // contains filtered or unexported fields }
Client is a utility mpd client tailored for the ui's purposes. It draws it's status onto the window `mpd`.
func NewClient ¶
NewClient returns a new mpd client that offers a few incomplete, convinience methods for altering MPD's state. It also renders the current state to the "mpd" window.
func (*Client) ActiveOutput ¶
ActiveOutput returns the currently selected output.
NOTE: MPD supports more than one active, but our software ignroes that.
(German software is excellent at ignoring reality.)
func (*Client) CurrentState ¶
CurrentState returns the current state ("play", "pause" or "stop")
func (*Client) EnableRandom ¶
EnableRandom sets the random state to `enable`.
func (*Client) ListPlaylists ¶
ListPlaylists returns all stored playlist names.
func (*Client) LoadAndPlayPlaylist ¶
LoadAndPlayPlaylist subsitutes the queue with the stored playlist `name` and immediately starts playing it's first song.
func (*Client) Outputs ¶
Outputs returns a list of outputnames. The index of the names are their ids.
func (*Client) Register ¶
Register remembers a function that will be called the idle event `signal` is received.
func (*Client) Run ¶
func (cl *Client) Run()
Run starts the client operations by keeping the status up-to-date and drawing it on the `mpd` window.
func (*Client) SwitchToOutput ¶
SwitchToOutput enables the output named bt `enableMe`.
func (*Client) TogglePlayback ¶
TogglePlayback toggles between pause and play. If the state is stop, the first queued song is played.
type ReMPD ¶
ReMPD is a mpd connection that automatically reconnects itself. Individual actions might still fail, but the next call is supposed to work again (after a possibly long re-connect dance).
type ReWatcher ¶
ReWatcher is like ReMPD, but re-connects a gompd.Watcher instance.
func NewReWatcher ¶
NewReWatcher returns a new ReWatcher on `host` and `port`. It will listen on all events in `listenOn`. It will stop watching when `ctx` is canceled.