Fix #522: add -volume-adjust-pct CLI arg

This commit is contained in:
Drew Weymouth
2025-01-05 16:45:48 -08:00
parent 0b73f47001
commit 9390f7b4e1
5 changed files with 44 additions and 18 deletions
+13 -3
View File
@@ -3,12 +3,14 @@ package backend
import (
"flag"
"strconv"
"strings"
)
var (
VolumeCLIArg int = -1
SeekToCLIArg float64 = -1
SeekByCLIArg float64 = 0
VolumeCLIArg int = -1
SeekToCLIArg float64 = -1
SeekByCLIArg float64 = 0
VolumePctCLIArg float64 = 0
FlagPlay = flag.Bool("play", false, "unpause or begin playback")
FlagPause = flag.Bool("pause", false, "pause playback")
@@ -36,6 +38,14 @@ func init() {
SeekByCLIArg = v
return err
})
flag.Func("volume-adjust-pct", "adjusts volume up or down by the given percentage (positive or negative)", func(s string) error {
if strings.HasSuffix(s, "%") {
s = s[:len(s)-1]
}
v, err := strconv.ParseFloat(s, 64)
VolumePctCLIArg = v
return err
})
}
func HaveCommandLineOptions() bool {