Esempio n. 1
0
func skipSong(client playsource.PlaysourceClient) {
	_, err := client.SkipSong(context.Background(), &playsource.SkipSongRequest{})
	if err != nil {
		log.Fatal(err)
	}

	log.Println("Skipped song")
}
Esempio n. 2
0
func playing(client playsource.PlaysourceClient) {
	resp, err := client.GetPlaying(context.Background(), &playsource.GetPlayingRequest{})
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("Playing: [%v] %v", resp.Song)
}
Esempio n. 3
0
func history(client playsource.PlaysourceClient) {
	stream, err := client.GetPlayHistory(context.Background(), &playsource.GetPlayHistoryRequest{})
	if err != nil {
		log.Fatal(err)
	}

	for {
		song, err := stream.Recv()
		if err == io.EOF {
			break
		}
		if err != nil {
			log.Fatal("Error retrieving history:", err)
		}

		log.Println("Song:", song)
	}
}