Split command executed in a separate file
This commit is contained in:
parent
6f495f4fe1
commit
41f8092419
@ -27,7 +27,7 @@ steps:
|
|||||||
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
||||||
- go get -v -d
|
- go get -v -d
|
||||||
- go vet -v
|
- go vet -v
|
||||||
- go build -v -ldflags '-w -X main.Version=${DRONE_BRANCH}-${DRONE_COMMIT} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
|
- go build -tags pulse -ldflags '-w -X main.Version=${DRONE_BRANCH}-${DRONE_COMMIT} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
|
||||||
- ln deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} reveil
|
- ln deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} reveil
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
@ -40,7 +40,7 @@ steps:
|
|||||||
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
||||||
- go get -v -d
|
- go get -v -d
|
||||||
- go vet -v
|
- go vet -v
|
||||||
- go build -v -ldflags '-w -X main.Version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}v7
|
- go build -tags pulse -ldflags '-w -X main.Version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}v7
|
||||||
- ln deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}v7 reveil
|
- ln deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}v7 reveil
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
@ -50,7 +50,7 @@ steps:
|
|||||||
image: golang:1-alpine
|
image: golang:1-alpine
|
||||||
commands:
|
commands:
|
||||||
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
||||||
- go build -v -tags netgo -ldflags '-w -X main.Version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}hf
|
- go build -tags pulse,netgo -ldflags '-w -X main.Version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}hf
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GOARM: 6
|
GOARM: 6
|
||||||
|
@ -15,7 +15,7 @@ RUN apk --no-cache add git go-bindata
|
|||||||
COPY . /go/src/git.nemunai.re/nemunaire/reveil
|
COPY . /go/src/git.nemunai.re/nemunaire/reveil
|
||||||
COPY --from=nodebuild /ui/build /go/src/git.nemunai.re/nemunaire/reveil/ui/build
|
COPY --from=nodebuild /ui/build /go/src/git.nemunai.re/nemunaire/reveil/ui/build
|
||||||
WORKDIR /go/src/git.nemunai.re/nemunaire/reveil
|
WORKDIR /go/src/git.nemunai.re/nemunaire/reveil
|
||||||
RUN go get -v && go generate -v && go build -v -ldflags="-s -w"
|
RUN go get -v && go generate -v && go build -tags pulse -ldflags="-s -w"
|
||||||
|
|
||||||
|
|
||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
@ -136,7 +136,7 @@ func (p *Player) launchAction(cfg *config.Config, a *reveil.Action) (err error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) playFile(filepath string) (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 {
|
if err = p.currentCmd.Start(); err != nil {
|
||||||
log.Println("Running paplay err: ", err.Error())
|
log.Println("Running paplay err: ", err.Error())
|
||||||
p.currentCmdCh <- true
|
p.currentCmdCh <- true
|
||||||
@ -270,7 +270,7 @@ func (p *Player) NextTrack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) SetVolume(volume uint16) error {
|
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()
|
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…
Reference in New Issue
Block a user