diff --git a/commander.go b/commander.go index b86ef56..9ecc190 100644 --- a/commander.go +++ b/commander.go @@ -14,14 +14,6 @@ func isInstalled(name string) bool { return true } -//func execute(cmdstr string) (string, error) { -// cmdargs := strings.Split(cmdstr, " ") // string arrayified -// cmd := cmdargs[0] // command -// cmdargs = append(cmdargs[:0], cmdargs[1:]...) // argument array sans cmd -// out, err := exec.Command(cmd, cmdargs...).CombinedOutput() -// return string(out[:]), err -//} - func subExecute(program string, args ...string) ([]byte, error) { cmd := exec.Command(program, args...) cmd.Stdin = os.Stdin diff --git a/radiomenu.go b/radiomenu.go index ef6e2d2..484d515 100644 --- a/radiomenu.go +++ b/radiomenu.go @@ -2,8 +2,9 @@ package main import ( "fmt" - "github.com/dixonwille/wmenu/v5" "os" + + "github.com/dixonwille/wmenu/v5" ) func Short( s string, i int ) string { diff --git a/stations.go b/stations.go index 4e15029..5955789 100644 --- a/stations.go +++ b/stations.go @@ -6,6 +6,13 @@ import ( "os" ) +func precheck(){ + if !isInstalled(player()){ + fmt.Printf("%s is either not installed, or not on your $PATH. Cannot continue.\n", player()) + os.Exit(1) + } +} + func main(){ argCount := len(os.Args[1:]) @@ -35,9 +42,9 @@ func main(){ flag.Usage() os.Exit(0) } + precheck() stations, _ := StationSearch(name, country, state, tags, notok) - menu := RadioMenu(stations) err := menu.Run() if err != nil {