Split command executed in a separate file
This commit is contained in:
parent
6f495f4fe1
commit
41f8092419
4 changed files with 15 additions and 6 deletions
|
|
@ -136,7 +136,7 @@ func (p *Player) launchAction(cfg *config.Config, a *reveil.Action) (err error)
|
|||
}
|
||||
|
||||
func (p *Player) playFile(filepath string) (err error) {
|
||||
p.currentCmd = exec.Command("paplay", filepath)
|
||||
p.currentCmd = exec.Command(playCommand, filepath)
|
||||
if err = p.currentCmd.Start(); err != nil {
|
||||
log.Println("Running paplay err: ", err.Error())
|
||||
p.currentCmdCh <- true
|
||||
|
|
@ -270,7 +270,7 @@ func (p *Player) NextTrack() {
|
|||
}
|
||||
|
||||
func (p *Player) SetVolume(volume uint16) error {
|
||||
cmd := exec.Command("amixer", "-D", "pulse", "set", "Master", fmt.Sprintf("%d", volume))
|
||||
cmd := exec.Command("amixer", "-D", mixerCard, "set", mixerName, fmt.Sprintf("%d", volume))
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
|
|
|
|||
9
player/player_pulse.go
Normal file
9
player/player_pulse.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
//go:build pulse
|
||||
|
||||
package player
|
||||
|
||||
const (
|
||||
playCommand = "paplay"
|
||||
mixerCard = "pulse"
|
||||
mixerName = "Master"
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue