gostations/stations.go

38 lines
708 B
Go
Raw Normal View History

2021-03-16 12:32:59 +00:00
package main
2021-03-16 13:09:27 +00:00
import (
"flag"
"fmt"
"os"
)
2021-03-16 12:32:59 +00:00
func main(){
2021-03-16 13:09:27 +00:00
argCount := len(os.Args[1:])
var (
name string
country string
state string
tags string
)
flag.StringVar(&name, "n", "", "Station name (or identifier).")
flag.StringVar(&country, "c", "", "Home country.")
flag.StringVar(&state, "s", "", "Home state (if in the United States).")
flag.StringVar(&tags, "t", "", "Tag (or comma-separated tag list)")
flag.Parse()
if argCount == 0 {
flag.Usage()
}
2021-03-16 12:32:59 +00:00
stations, err := GetStations("tag=chicago")
if err != nil{
fmt.Println(err.Error())
}
for _, station := range stations {
fmt.Printf("\"%s\", %s, %s, %s\n", station.Name, station.Codec, station.Bitrate, station.Url)
}
2021-03-16 12:32:59 +00:00
}