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
+17 -12
View File
@@ -3,18 +3,19 @@ package ipc
import "fmt"
const (
PingPath = "/ping"
PlayPath = "/transport/play"
PlayPausePath = "/transport/playpause"
PausePath = "/transport/pause"
StopPath = "/transport/stop"
PreviousPath = "/transport/previous"
NextPath = "/transport/next"
TimePosPath = "/transport/timepos" // ?s=<seconds>
SeekByPath = "/transport/seek-by" // ?s=<+/- seconds>
VolumePath = "/volume" // ?v=<vol>
ShowPath = "/window/show"
QuitPath = "/window/quit"
PingPath = "/ping"
PlayPath = "/transport/play"
PlayPausePath = "/transport/playpause"
PausePath = "/transport/pause"
StopPath = "/transport/stop"
PreviousPath = "/transport/previous"
NextPath = "/transport/next"
TimePosPath = "/transport/timepos" // ?s=<seconds>
SeekByPath = "/transport/seek-by" // ?s=<+/- seconds>
VolumePath = "/volume" // ?v=<vol>
VolumeAdjustPath = "/volume/adjust" // ?pct=<+/- percentage>
ShowPath = "/window/show"
QuitPath = "/window/quit"
)
type Response struct {
@@ -25,6 +26,10 @@ func SetVolumePath(vol int) string {
return fmt.Sprintf("%s?v=%d", VolumePath, vol)
}
func AdjustVolumePctPath(pct float64) string {
return fmt.Sprintf("%s?pct=%0.2f", VolumeAdjustPath, pct)
}
func SeekToSecondsPath(secs float64) string {
return fmt.Sprintf("%s?s=%0.2f", TimePosPath, secs)
}