Ejemplo n.º 1
0
func handlePlayCommand(tokens []string) {
	music := lib.Find(tokens[1])
	if music == nil {
		fmt.Println("find failed ", tokens[1])
		return
	}
	mp.Play(music.Name, music.Type)
}
Ejemplo n.º 2
0
func handlePlayCommand(tokens []string) {
	if len(tokens) != 2 {
		fmt.Println("USAGE: play <name>")
		return
	}
	e := lib.Find(tokens[1])
	if e == nil {
		fmt.Println("The music", tokens[1], "does not exist.")
		return
	}
	mp.Play(e.Source, e.Type)
}
Ejemplo n.º 3
0
func handleCommand(tokens []string) {
	if len(tokens) != 2 {
		fmt.Println(`USAGE: play <name>
			stop <name>
			`)
		return
	}
	e, _ := lib.Find(tokens[1])
	if e == nil {
		fmt.Println("The music", tokens[1], "does not exist.")
		return
	}
	switch tokens[0] {
	case "play":
		mp.Play(e.Source, e.Type, "play")
	case "stop":
		mp.Play(e.Source, e.Type, "stop")
	default:
		fmt.Println(`USAGE: play <name>
			stop <name>
			`)
	}
}