iTunesService

command module
v0.0.0-...-11f7e77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 16 Imported by: 0

README

iTunesService

usage

package main

import (
	"context"
	"log"
	"time"

	pb "github.com/solarhell/iTunesService/applemusic"
	"google.golang.org/grpc"
)

func main() {
	ctx := context.Background()
	ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
	defer cancel()

	conn, err := grpc.DialContext(
		ctx,
		"103.121.209.132:50051",
		grpc.WithInsecure(),
		grpc.WithBlock(),
	)
	if err != nil {
		panic(err)
	}

	appleMusic := pb.NewMusicClient(conn)
	ctx, cancel = context.WithTimeout(ctx, 5*time.Second)
	defer cancel()

	reply, err := appleMusic.GetArtistPicture(ctx, &pb.CheckRequest{ArtistName: "李志"})
	if err != nil {
		panic(err)
	}

	log.Printf("获取到歌手照片: %s\n", reply.Picture)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL