Documentation ¶
Index ¶
- type Address
- type Connection
- type PMS
- func (pms *PMS) API() api.API
- func (pms *PMS) CurrentMpdClient() *mpd.Client
- func (pms *PMS) CurrentSonglistWidget() api.SonglistWidget
- func (pms *PMS) Database() *db.Instance
- func (pms *PMS) Error(format string, a ...interface{})
- func (pms *PMS) Execute(cmd string)
- func (pms *PMS) KeyInput(ev *tcell.EventKey)
- func (pms *PMS) Main()
- func (pms *PMS) Message(format string, a ...interface{})
- func (pms *PMS) Multibar() api.MultibarWidget
- func (pms *PMS) RunTicker()
- func (pms *PMS) SourceConfig(reader io.Reader) error
- func (pms *PMS) SourceConfigFile(path string) error
- func (pms *PMS) SourceDefaultConfig() error
- func (pms *PMS) Stylesheet() style.Stylesheet
- func (pms *PMS) SyncLibrary() error
- func (pms *PMS) SyncQueue() error
- func (pms *PMS) UI() api.UI
- func (pms *PMS) UpdateCurrentSong() error
- func (pms *PMS) UpdatePlayerStatus() error
- func (pms *PMS) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { Host string Port string Password string Connected chan struct{} IdleEvents chan string // contains filtered or unexported fields }
Connection maintains connections to an MPD server. Two separate connections are made: one for IDLE events, and another as a control connection. The IDLE connection is kept open continuously, while the control connection is allowed to time out.
This class is used by calling the Run method as a goroutine.
func NewConnection ¶
func NewConnection(messages chan message.Message) *Connection
NewConnection returns Connection.
func (*Connection) Error ¶
func (c *Connection) Error(format string, a ...interface{})
Error sends an error message on the message bus.
func (*Connection) Message ¶
func (c *Connection) Message(format string, a ...interface{})
Message sends a message on the message bus.
func (*Connection) MpdClient ¶
func (c *Connection) MpdClient() (*mpd.Client, error)
MpdClient pings the MPD server and returns the client object if both the IDLE connection and control connection are ready. Otherwise this function returns nil.
func (*Connection) Open ¶
func (c *Connection) Open(host, port, password string)
Open sets the host, port, and password parameters, closes any existing connections, and asynchronously connects to MPD as long as Run() is called.
func (*Connection) Run ¶
func (c *Connection) Run()
Run is the main goroutine of Connection. This thread will maintain an IDLE connection to the MPD server, and reconnect if the connection has errors.
type PMS ¶
type PMS struct { CLI *input.CLI Options *options.Options Sequencer *keys.Sequencer // MPD connection object Connection *Connection // EventList receives a signal when current songlist has been changed. EventList chan int // EventLibrary receives a signal when MPD's library has been updated and retrieved. EventLibrary chan int // EventMessage is used to display text in the statusbar. EventMessage chan message.Message // EventOption receives a signal when options have been changed. EventOption chan string // EventPlayer receives a signal when MPD's "player" status changes in an IDLE event. EventPlayer chan int // EventPlayer receives a signal when MPD's "playlist" status changes in an IDLE event. EventQueue chan int // EventPlayer receives a signal when PMS should quit. QuitSignal chan int // contains filtered or unexported fields }
PMS is a kitchen sink of different objects, glued together as a singleton class.
func (*PMS) CurrentMpdClient ¶
CurrentMpdClient ensures there is a valid MPD connection, and returns the MPD client object.
func (*PMS) CurrentSonglistWidget ¶
func (pms *PMS) CurrentSonglistWidget() api.SonglistWidget
CurrentSonglistWidget returns the current songlist.
func (*PMS) KeyInput ¶
func (pms *PMS) KeyInput(ev *tcell.EventKey)
KeyInput receives key input signals, checks the sequencer for key bindings, and runs commands if key bindings are found.
func (*PMS) Multibar ¶
func (pms *PMS) Multibar() api.MultibarWidget
Multibar returns the multibar widget.
func (*PMS) RunTicker ¶
func (pms *PMS) RunTicker()
RunTicker starts a ticker that will increase the elapsed time every second.
func (*PMS) SourceConfig ¶
SourceConfig reads, parses, and executes config lines.
func (*PMS) SourceConfigFile ¶
SourceConfigFile reads, parses, and executes a config file.
func (*PMS) SourceDefaultConfig ¶
SourceDefaultConfig reads, parses, and executes the default config.
func (*PMS) Stylesheet ¶
func (pms *PMS) Stylesheet() style.Stylesheet
Stylesheet returns the global stylesheet.
func (*PMS) SyncLibrary ¶
SyncLibrary retrieves the MPD library and stores it as a Songlist in the PMS.Library variable. Furthermore, the search index is opened, and if it is older than the database version, a reindex task is started.
If the Songlist or Index is cached at the correct version, that part goes untouched.
func (*PMS) UpdateCurrentSong ¶
UpdateCurrentSong stores a local copy of the currently playing song.
func (*PMS) UpdatePlayerStatus ¶
UpdatePlayerStatus populates pms.mpdStatus with data from the MPD server.