diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-05-28 19:34:36 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-05-28 19:34:36 +0200 |
| commit | 6fef9c693b98bd8c2bf63162baedeb5123e963f3 (patch) | |
| tree | b749cb3adc2a082e2128e49984f4beb414591b05 | |
| parent | dadf23a40cfa2eff2e5caa5c1edd24a6b550e95a (diff) | |
| download | WRMS-6fef9c693b98bd8c2bf63162baedeb5123e963f3.tar.gz WRMS-6fef9c693b98bd8c2bf63162baedeb5123e963f3.zip | |
support custom mpv flags
| -rw-r--r-- | config.go | 1 | ||||
| -rw-r--r-- | player.go | 12 |
2 files changed, 12 insertions, 1 deletions
@@ -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 @@ -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() } |
