31 lines
700 B
Go
31 lines
700 B
Go
// Package raudio detects rAudio installations and controls playback through MPD.
|
|
package raudio
|
|
|
|
import (
|
|
"github.com/BeatGlow/beatglow/config"
|
|
"github.com/BeatGlow/beatglow/player"
|
|
"github.com/BeatGlow/beatglow/player/mpd"
|
|
)
|
|
|
|
func init() {
|
|
player.Register("raudio", func(config *config.Player) (player.Player, error) {
|
|
return New(config)
|
|
}, Detect, 1)
|
|
}
|
|
|
|
type Player struct {
|
|
*mpd.Player
|
|
}
|
|
|
|
func New(config *config.Player) (*Player, error) {
|
|
p, err := mpd.New(config.Host, config.Password)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Player{Player: p}, nil
|
|
}
|
|
|
|
func (p *Player) Name() string { return "rAudio" }
|
|
|
|
func (p *Player) String() string { return "rAudio@" + p.Player.String() }
|