homecast

package module
v0.0.0-...-62a472f Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 9 Imported by: 0

README

homecast

Make your speaker speak.

homecast is a Go package to enable text-to-speech on Google Home in local network.

This is Go version of noelportugal/google-home-notifier

Install

$ go get -u github.com/ikasamah/homecast

Usage

ctx := context.Background()
devices := homecast.LookupAndConnect(ctx)

for _, device := range devices {
    err := device.Speak(ctx, "Hello World", "en")
}

Run example

$ go run $GOPATH/src/github.com/ikasamah/homecast/example/main.go

Server erxample

$ go run $GOPATH/src/github.com/ikasamah/homecast/example/server.go

Then, access following URL in your browser.

http://localhost:8080/?text=Ciao&lang=it

Author

Masayuki Hamasaki

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CastDevice

type CastDevice struct {
	*mdns.ServiceEntry
	// contains filtered or unexported fields
}

CastDevice is cast-able device contains cast client

func LookupAndConnect

func LookupAndConnect(ctx context.Context) []*CastDevice

LookupAndConnect retrieves cast-able google home devices

func (*CastDevice) Close

func (g *CastDevice) Close()

Close calls client's close func

func (*CastDevice) Connect

func (g *CastDevice) Connect(ctx context.Context) error

Connect connects required services to cast

func (*CastDevice) Play

func (g *CastDevice) Play(ctx context.Context, url *url.URL) error

Play plays media contents on cast device

func (*CastDevice) Speak

func (g *CastDevice) Speak(ctx context.Context, text, lang string) error

Speak speaks given text on cast device

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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