more jukebox work

This commit is contained in:
Drew Weymouth
2024-08-31 09:09:12 -07:00
parent 3bad04a74a
commit c2efb048e2
3 changed files with 68 additions and 30 deletions
+7 -2
View File
@@ -298,11 +298,16 @@ type JukeboxProvider interface {
JukeboxStop() error
JukeboxSeek(idx, seconds int) error
JukeboxClear() error
JukeboxSet(trackID string) error
JukeboxAdd(trackID string) error
JukeboxRemove(idx int) error
JukeboxSetVolume(vol int) error
JukeboxGetStatus() (*JukeboxStatus, error)
// Performs a Clear followed by an Add to set the queue
// to contain a single track
JukeboxSet(trackID string) error
// Sets the volume of the jukebox player (0-100)
JukeboxSetVolume(vol int) error
}
type JukeboxStatus struct {
+3 -1
View File
@@ -1,6 +1,7 @@
package subsonic
import (
"fmt"
"strconv"
"github.com/dweymouth/supersonic/backend/mediaprovider"
@@ -24,8 +25,9 @@ func (s *subsonicMediaProvider) JukeboxClear() error {
}
func (s *subsonicMediaProvider) JukeboxSetVolume(vol int) error {
v := float64(vol) / 100
_, err := s.client.JukeboxControl("setGain",
map[string]string{"gain": strconv.Itoa(vol)})
map[string]string{"gain": fmt.Sprintf("%0.2f", v)})
return err
}