Commit 65fb4270ab
Unregistered key
Layout: unified · split
internal/player.go +9 −3
| @@ -11,6 +11,7 @@ import ( | |||
| 11 | "strings" | 11 | "strings" |
| 12 | "sync" | 12 | "sync" |
| 13 | "time" | 13 | "time" |
| 14 | "errors" | ||
| 14 | ) | 15 | ) |
| 15 | 16 | ||
| 16 | var logFile = "debug.log" | 17 | var logFile = "debug.log" |
| @@ -114,9 +115,14 @@ func StartVideo(link string, args []string, title string, anime *Anime) (string, | |||
| 114 | return "", err | 115 | return "", err |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | // Create command for Windows | 118 | if _, err := os.Stat(mpvPath); err == nil { |
| 118 | command = exec.Command(mpvPath, mpvArgs...) | 119 | command = exec.Command(mpvPath, mpvArgs...) |
| 119 | } else { | 120 | |
| 121 | } else if errors.Is(err, os.ErrNotExist) { | ||
| 122 | //for windows with mpv on PATH | ||
| 123 | command = exec.Command("mpv", mpvArgs...) | ||
| 124 | |||
| 125 | } else { | ||
| 120 | // Create command for Unix-like systems | 126 | // Create command for Unix-like systems |
| 121 | command = exec.Command("mpv", mpvArgs...) | 127 | command = exec.Command("mpv", mpvArgs...) |
| 122 | } | 128 | } |