Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:29:41 +01:00
1 parent 85a9ec684c
commit c5d6137fab
160 files changed
+76293 -387

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
package mpd
func (p *Player) Command(format string, args ...interface{}) error {
command := newSimpleCommand(format, args...)
p.simpleCommands <- command
err := <-command.Err
close(command.Err)
return err
}
type simpleCommand struct {
Format string
Args []interface{}
Err chan error
}
func newSimpleCommand(format string, args ...interface{}) *simpleCommand {
return &simpleCommand{
Format: format,
Args: args,
Err: make(chan error, 1),
}
}
func (p *Player) CommandData(format string, args ...interface{}) ([]string, error) {
command := newDataCommand(format, args...)
p.dataCommands <- command
err := <-command.Err
close(command.Err)
return command.Lines, err
}
func newDataCommand(format string, args ...interface{}) *dataCommand {
return &dataCommand{
Format: format,
Args: args,
Err: make(chan error, 1),
}
}
type dataCommand struct {
Format string
Args []interface{}
Lines []string
Err chan error
}