Mirakurun Client for Go.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
testdata
.codeclimate.yml
.editorconfig
.travis.yml
CODE_OF_CONDUCT.md
LICENSE
README.md
channels.go
channels_test.go
doc.go
events.go
events_test.go
example_test.go
mirakurun.go
mirakurun_test.go
programs.go
programs_test.go
server.go
server_test.go
services.go
services_test.go
timestamp.go
tuners.go
tuners_test.go

README.md

go-mirakurun

go-mirakurun is a Mirakurun Client for Go.

build status GoDoc

Usage

import "ykzts.com/x/mirakurun"

Channel Scan

c := mirakurun.NewClient()

opt := &mirakurun.ChannelScanOptions{Type: "BS"}
stream, _, err := c.ChannelScan(context.Background(), opt)
if err != nil {
	log.Fatal(err)
}
defer stream.Close()

io.Copy(os.Stdout, stream)

Get Channel List

c := mirakurun.NewClient()

channels, _, err := c.GetChannels(context.Background(), nil)
if err != nil {
	log.Fatal(err)
}

for _, channel := range channels {
	fmt.Printf("%s (%s): %s\n", channel.Channel, channel.Type, channel.Name)
}

Recoding

c := mirakurun.NewClient()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

stream, _, err := c.GetServiceStream(ctx, 3239123608, true)
if err != nil {
	log.Fatal(err)
}
defer stream.Close()

name := fmt.Sprintf("stream-%d.ts", time.Now().Unix())
file, err := os.Create(name)
if err != nil {
	log.Fatal(err)
}
defer file.Close()

fmt.Printf("save to %s\n", name)

io.Copy(file, stream)

License

MIT