aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.go1
-rw-r--r--player.go12
2 files changed, 12 insertions, 1 deletions
diff --git a/config.go b/config.go
index 331fb7f..fd622dc 100644
--- a/config.go
+++ b/config.go
@@ -16,6 +16,7 @@ type Config struct {
LocalMusicDir string `yaml:"music-dir"`
UploadDir string `yaml:"upload-dir"`
LogLevel string `yaml:"loglevel"`
+ MpvFlags string `yaml:"mpv_flags"`
Admin uuid.UUID `yaml:"admin"`
Spotify *SpotifyConfig `yaml:"spotify"`
HasUpload bool
diff --git a/player.go b/player.go
index b2539dd..f1b01ac 100644
--- a/player.go
+++ b/player.go
@@ -3,6 +3,7 @@ package main
import (
"io"
"os/exec"
+ "strings"
"sync"
"syscall"
@@ -76,9 +77,18 @@ func (player *Player) runMpv() {
wrms.Next()
}
+const MPV_FLAGS = "--no-video"
+
func (player *Player) PlayUri(uri string) {
llog.Info("Start mpv with %s", uri)
- player.mpv = exec.Command("mpv", "--no-video", uri)
+ cmd := []string{"mpv", uri}
+
+ cmd = append(cmd, strings.Split(MPV_FLAGS, " ")...)
+
+ cmd = append(cmd, strings.Split(wrms.Config.MpvFlags, " ")...)
+
+ llog.Debug("Running '%s'", strings.Join(cmd, " "))
+ player.mpv = exec.Command("mpv", cmd...)
go player.runMpv()
}