add a check for the console stream player
This commit is contained in:
parent
b92b63e1a7
commit
73dc128eb9
@ -14,14 +14,6 @@ func isInstalled(name string) bool {
|
|||||||
return true
|
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) {
|
func subExecute(program string, args ...string) ([]byte, error) {
|
||||||
cmd := exec.Command(program, args...)
|
cmd := exec.Command(program, args...)
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
|
@ -2,8 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dixonwille/wmenu/v5"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/dixonwille/wmenu/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Short( s string, i int ) string {
|
func Short( s string, i int ) string {
|
||||||
|
@ -6,6 +6,13 @@ import (
|
|||||||
"os"
|
"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(){
|
func main(){
|
||||||
argCount := len(os.Args[1:])
|
argCount := len(os.Args[1:])
|
||||||
|
|
||||||
@ -35,9 +42,9 @@ func main(){
|
|||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
precheck()
|
||||||
|
|
||||||
stations, _ := StationSearch(name, country, state, tags, notok)
|
stations, _ := StationSearch(name, country, state, tags, notok)
|
||||||
|
|
||||||
menu := RadioMenu(stations)
|
menu := RadioMenu(stations)
|
||||||
err := menu.Run()
|
err := menu.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user