diff --git a/cmd/open-in-mpv/main.go b/cmd/open-in-mpv/main.go index b76206a..af0dbfd 100644 --- a/cmd/open-in-mpv/main.go +++ b/cmd/open-in-mpv/main.go @@ -38,8 +38,8 @@ func main() { log.Println("Error writing to socket, opening new instance") } - args := opts.GenerateCommand() - player := exec.Command(opts.Player, args...) + executable, args := opts.GenerateCommand() + player := exec.Command(executable, args...) log.Println(player.String()) must(player.Start()) // must(player.Wait()) diff --git a/options.go b/options.go index 2e986e0..01f0737 100644 --- a/options.go +++ b/options.go @@ -149,7 +149,7 @@ func (o Options) overrideFlags() string { // Builds a CLI command used to invoke the player with the appropriate // arguments -func (o Options) GenerateCommand() []string { +func (o Options) GenerateCommand() (string, []string) { var ret []string playerConfig := GetPlayerConfig(o.Player) @@ -172,7 +172,7 @@ func (o Options) GenerateCommand() []string { ret = append(ret, o.Url.String()) - return ret + return playerConfig.Executable, ret } // Builds the IPC command needed to enqueue videos if the player requires it diff --git a/options_test.go b/options_test.go index ad4f32e..fb12a15 100644 --- a/options_test.go +++ b/options_test.go @@ -31,8 +31,8 @@ func Test_GenerateCommand(t *testing.T) { o.Flags = "--vo=gpu" o.Pip = true - args := o.GenerateCommand() - t.Logf("%s %v", o.Player, args) + executable, args := o.GenerateCommand() + t.Logf("%s %v", executable, args) } func Test_GenerateIPC(t *testing.T) { @@ -98,8 +98,8 @@ func Test_Parse(t *testing.T) { t.Fatal("Err should not be nil") } - args := o.GenerateCommand() - t.Logf("%s %v", o.Player, args) + executable, args := o.GenerateCommand() + t.Logf("%s %v", executable, args) } func Test_sliceContains(t *testing.T) {