Documentation
¶
Overview ¶
Package mirakurun provides Mirakurun API client.
The Mirakurun API specification is at https://github.com/Chinachu/Mirakurun/blob/master/api.yml.
Index ¶
- type Channel
- type ChannelConfig
- type ChannelScanOptions
- type ChannelsConfig
- type ChannelsListOptions
- type Client
- func (c *Client) ChannelScan(ctx context.Context, opt *ChannelScanOptions) (io.ReadCloser, *http.Response, error)
- func (c *Client) CheckVersion(ctx context.Context) (*Version, *http.Response, error)
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GetChannel(ctx context.Context, typ string, channelID string) (*Channel, *http.Response, error)
- func (c *Client) GetChannels(ctx context.Context, opt *ChannelsListOptions) ([]*Channel, *http.Response, error)
- func (c *Client) GetChannelsByType(ctx context.Context, typ string, opt *ChannelsListOptions) ([]*Channel, *http.Response, error)
- func (c *Client) GetChannelsConfig(ctx context.Context) (ChannelsConfig, *http.Response, error)
- func (c *Client) GetEvents(ctx context.Context) ([]*Event, *http.Response, error)
- func (c *Client) GetEventsStream(ctx context.Context, opt *EventsListOptions) (io.ReadCloser, *http.Response, error)
- func (c *Client) GetLog(ctx context.Context) (*bytes.Buffer, *http.Response, error)
- func (c *Client) GetLogStream(ctx context.Context) (io.ReadCloser, *http.Response, error)
- func (c *Client) GetLogoImage(ctx context.Context, id int) (io.ReadCloser, *http.Response, error)
- func (c *Client) GetProgram(ctx context.Context, id int) (*Program, *http.Response, error)
- func (c *Client) GetProgramStream(ctx context.Context, id int, decode bool) (io.ReadCloser, *http.Response, error)
- func (c *Client) GetPrograms(ctx context.Context, opt *ProgramsListOptions) ([]*Program, *http.Response, error)
- func (c *Client) GetServerConfig(ctx context.Context) (*ServerConfig, *http.Response, error)
- func (c *Client) GetService(ctx context.Context, id int) (*Service, *http.Response, error)
- func (c *Client) GetServiceByChannel(ctx context.Context, typ string, channel string, sid int) (*Service, *http.Response, error)
- func (c *Client) GetServiceStream(ctx context.Context, id int, decode bool) (io.ReadCloser, *http.Response, error)
- func (c *Client) GetServiceStreamByChannel(ctx context.Context, typ string, channel string, sid int, decode bool) (io.ReadCloser, *http.Response, error)
- func (c *Client) GetServices(ctx context.Context, opt *ServicesListOptions) ([]*Service, *http.Response, error)
- func (c *Client) GetServicesByChannel(ctx context.Context, typ string, channel string) ([]*Service, *http.Response, error)
- func (c *Client) GetStatus(ctx context.Context) (*Status, *http.Response, error)
- func (c *Client) GetTuner(ctx context.Context, index int) (*TunerDevice, *http.Response, error)
- func (c *Client) GetTunerProcess(ctx context.Context, index int) (*TunerProcess, *http.Response, error)
- func (c *Client) GetTuners(ctx context.Context) ([]*TunerDevice, *http.Response, error)
- func (c *Client) GetTunersConfig(ctx context.Context) (TunersConfig, *http.Response, error)
- func (c *Client) KillTunerProcess(ctx context.Context, index int) (*TunerProcess, *http.Response, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) Restart(ctx context.Context) (*RestartResponse, *http.Response, error)
- func (c *Client) UpdateChannelsConfig(ctx context.Context, body ChannelsConfig) (ChannelsConfig, *http.Response, error)
- func (c *Client) UpdateServerConfig(ctx context.Context, body *ServerConfig) (*ServerConfig, *http.Response, error)
- func (c *Client) UpdateTunersConfig(ctx context.Context, body TunersConfig) (TunersConfig, *http.Response, error)
- func (c *Client) UpdateVersion(ctx context.Context, opt *VersionUpdateOptions) (io.ReadCloser, *http.Response, error)
- type DecodeOptions
- type EPGStatus
- type Event
- type EventsListOptions
- type ProcessStatus
- type Program
- type ProgramAudio
- type ProgramGenre
- type ProgramRelatedItem
- type ProgramSeries
- type ProgramVideo
- type ProgramsListOptions
- type RestartResponse
- type ServerConfig
- type Service
- type ServicesListOptions
- type Status
- type TimerAccuracyStatus
- type Timestamp
- type TunerConfig
- type TunerDevice
- type TunerProcess
- type TunerUser
- type TunersConfig
- type Version
- type VersionUpdateOptions
Examples ¶
- Client.ChannelScan
- Client.CheckVersion
- Client.GetChannel
- Client.GetChannels
- Client.GetChannelsByType
- Client.GetChannelsConfig
- Client.GetEvents
- Client.GetEventsStream
- Client.GetLog
- Client.GetLogStream
- Client.GetLogoImage
- Client.GetProgram
- Client.GetProgramStream
- Client.GetPrograms
- Client.GetServerConfig
- Client.GetService
- Client.GetServiceByChannel
- Client.GetServiceStream
- Client.GetServiceStreamByChannel
- Client.GetServices
- Client.GetServicesByChannel
- Client.GetStatus
- Client.GetTuner
- Client.GetTunerProcess
- Client.GetTuners
- Client.GetTunersConfig
- Client.KillTunerProcess
- Client.Restart
- Client.UpdateChannelsConfig
- Client.UpdateServerConfig
- Client.UpdateTunersConfig
- Client.UpdateVersion
- NewClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { Type string `json:"type"` Channel string `json:"channel"` Name string `json:"name,omitempty"` Satelite string `json:"satelite,omitempty"` Space int64 `json:"space,omitempty"` Services []Service `json:"services,omitempty"` }
Channel represents a Mirakurun channel.
type ChannelConfig ¶
type ChannelConfig struct { Name string `json:"name"` Type string `json:"type"` Channel string `json:"channel"` Satelite string `json:"satelite,omitempty"` ServiceID int `json:"serviceId,omitempty"` Space int `json:"space,omitempty"` IsDisabled bool `json:"isDisabled,omitempty"` }
ChannelConfig represents a Mirakurun channel config
type ChannelScanOptions ¶
type ChannelScanOptions struct { Type string `url:"type,omitempty"` Min int `url:"min,omitempty"` Max int `url:"max,omitempty"` }
ChannelScanOptions specifies the optional parameters to the Client.ChannelScan method.
type ChannelsConfig ¶
type ChannelsConfig []*ChannelConfig
ChannelsConfig represents a Mirakurun channels config.
type ChannelsListOptions ¶
type ChannelsListOptions struct { Type string `url:"type,omitempty"` Channel string `url:"channel,omitempty"` Name string `url:"name,omitempty"` }
ChannelsListOptions specifies the optional parameters to the Client.GetChannels method and Client.GetChannelsByType method.
type Client ¶
type Client struct { BaseURL *url.URL Priority int UserAgent string // contains filtered or unexported fields }
A Client manages communication with the Mirakurun API.
func NewClient ¶
func NewClient() *Client
NewClient returns a new Mirakurun API client.
Example ¶
package main import ( "context" "fmt" "log" "net/url" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() c.BaseURL, _ = url.Parse("http://192.168.0.5:40772/api/") programs, _, err := c.GetPrograms(context.Background(), nil) if err != nil { log.Fatal(err) } fmt.Println("Program count: ", len(programs)) }
Output:
func (*Client) ChannelScan ¶
func (c *Client) ChannelScan(ctx context.Context, opt *ChannelScanOptions) (io.ReadCloser, *http.Response, error)
ChannelScan scans a channels.
Example ¶
package main import ( "context" "io" "log" "os" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() stream, _, err := c.ChannelScan(context.Background(), nil) if err != nil { log.Fatal(err) } defer stream.Close() io.Copy(os.Stdout, stream) }
Output:
func (*Client) CheckVersion ¶
CheckVersion fetches a Mirakurun version.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() version, _, err := c.CheckVersion(context.Background()) if err != nil { log.Fatal(err) } fmt.Println("Current: " + version.Current) fmt.Println("Latest: " + version.Latest) }
Output:
func (*Client) GetChannel ¶
func (c *Client) GetChannel(ctx context.Context, typ string, channelID string) (*Channel, *http.Response, error)
GetChannel fetches a channel.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() channel, _, err := c.GetChannel(context.Background(), "GR", "16") if err != nil { log.Fatal(err) } fmt.Printf("%s (%s): %s\n", channel.Channel, channel.Type, channel.Name) }
Output:
func (*Client) GetChannels ¶
func (c *Client) GetChannels(ctx context.Context, opt *ChannelsListOptions) ([]*Channel, *http.Response, error)
GetChannels lists the channels.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { 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) } }
Output:
func (*Client) GetChannelsByType ¶
func (c *Client) GetChannelsByType(ctx context.Context, typ string, opt *ChannelsListOptions) ([]*Channel, *http.Response, error)
GetChannelsByType lists the channels for the specified type.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() channels, _, err := c.GetChannelsByType(context.Background(), "GR", nil) if err != nil { log.Fatal(err) } for _, channel := range channels { fmt.Printf("%s (%s): %s\n", channel.Channel, channel.Type, channel.Name) } }
Output:
func (*Client) GetChannelsConfig ¶
GetChannelsConfig fetches a channels config.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() config, _, err := c.GetChannelsConfig(context.Background()) if err != nil { log.Fatal(err) } for _, cItem := range config { fmt.Printf("%s: %v\n", cItem.Name, cItem.IsDisabled) } }
Output:
func (*Client) GetEvents ¶
GetEvents lists the events.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() events, _, err := c.GetEvents(context.Background()) if err != nil { log.Fatal(err) } for _, event := range events { fmt.Printf("%s: %s\n", event.Resource, event.Type) } }
Output:
func (*Client) GetEventsStream ¶
func (c *Client) GetEventsStream(ctx context.Context, opt *EventsListOptions) (io.ReadCloser, *http.Response, error)
GetEventsStream fetches a events stream.
Example ¶
package main import ( "context" "io" "log" "os" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() stream, _, err := c.GetEventsStream(context.Background(), nil) if err != nil { log.Fatal(err) } defer stream.Close() io.Copy(os.Stdout, stream) }
Output:
func (*Client) GetLog ¶
GetLog fetches a log.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() buf, _, err := c.GetLog(context.Background()) if err != nil { log.Fatal(err) } fmt.Println(buf) }
Output:
func (*Client) GetLogStream ¶
GetLogStream fetches a log stream.
Example ¶
package main import ( "context" "io" "log" "os" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() stream, _, err := c.GetLogStream(context.Background()) if err != nil { log.Fatal(err) } defer stream.Close() io.Copy(os.Stdout, stream) }
Output:
func (*Client) GetLogoImage ¶
GetLogoImage fetches a service logo stream.
Example ¶
package main import ( "context" "fmt" "io" "log" "os" "time" "ykzts.com/x/mirakurun" ) func main() { filename := fmt.Sprintf("/tmp/logo-%d.png", time.Now().Unix()) file, err := os.Create(filename) if err != nil { log.Fatal(err) } c := mirakurun.NewClient() stream, _, err := c.GetLogoImage(context.Background(), 3239123608) if err != nil { log.Fatal(err) } defer stream.Close() fmt.Println("output: ", filename) io.Copy(file, stream) }
Output:
func (*Client) GetProgram ¶
GetProgram fetches a program.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() program, _, err := c.GetProgram(context.Background(), 323912360802956) if err != nil { log.Fatal(err) } fmt.Printf("%d: %s (%v)\n", program.ID, program.Name, program.StartAt) fmt.Println(program.Description) if program.Extended != nil { fmt.Println("") for key, value := range program.Extended { fmt.Printf("%s: %s\n", key, value) } } }
Output:
func (*Client) GetProgramStream ¶
func (c *Client) GetProgramStream(ctx context.Context, id int, decode bool) (io.ReadCloser, *http.Response, error)
GetProgramStream fetches a program stream.
Example ¶
package main import ( "context" "fmt" "io" "log" "os" "time" "ykzts.com/x/mirakurun" ) func main() { filename := fmt.Sprintf("/tmp/stream-%d.ts", time.Now().Unix()) file, err := os.Create(filename) if err != nil { log.Fatal(err) } c := mirakurun.NewClient() ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() stream, _, err := c.GetProgramStream(ctx, 323912360802956, true) if err != nil { log.Fatal(err) } defer stream.Close() fmt.Println("output: ", filename) io.Copy(file, stream) }
Output:
func (*Client) GetPrograms ¶
func (c *Client) GetPrograms(ctx context.Context, opt *ProgramsListOptions) ([]*Program, *http.Response, error)
GetPrograms lists the programs.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() opt := &mirakurun.ProgramsListOptions{ServiceID: 23608} programs, _, err := c.GetPrograms(context.Background(), opt) if err != nil { log.Fatal(err) } for _, program := range programs { fmt.Printf("%d: %s (%v)\n", program.ID, program.Name, program.StartAt) } }
Output:
func (*Client) GetServerConfig ¶
GetServerConfig fetches a server config.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() config, _, err := c.GetServerConfig(context.Background()) if err != nil { log.Fatal(err) } fmt.Printf(":%d%s\n", config.Port, config.Path) }
Output:
func (*Client) GetService ¶
GetService fetches a service.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() service, _, err := c.GetService(context.Background(), 3239123608) if err != nil { log.Fatal(err) } fmt.Printf("%d: %s\n", service.ID, service.Name) }
Output:
func (*Client) GetServiceByChannel ¶
func (c *Client) GetServiceByChannel(ctx context.Context, typ string, channel string, sid int) (*Service, *http.Response, error)
GetServiceByChannel fetches a service for the specified channel.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() service, _, err := c.GetServiceByChannel(context.Background(), "GR", "16", 3239123608) if err != nil { log.Fatal(err) } fmt.Printf("%d: %s\n", service.ID, service.Name) }
Output:
func (*Client) GetServiceStream ¶
func (c *Client) GetServiceStream(ctx context.Context, id int, decode bool) (io.ReadCloser, *http.Response, error)
GetServiceStream fetches a service stream.
Example ¶
package main import ( "context" "fmt" "io" "log" "os" "time" "ykzts.com/x/mirakurun" ) func main() { filename := fmt.Sprintf("/tmp/stream-%d.ts", time.Now().Unix()) file, err := os.Create(filename) if err != nil { log.Fatal(err) } c := mirakurun.NewClient() ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() stream, _, err := c.GetServiceStream(ctx, 3239123608, true) if err != nil { log.Fatal(err) } defer stream.Close() fmt.Println("output: ", filename) io.Copy(file, stream) }
Output:
func (*Client) GetServiceStreamByChannel ¶
func (c *Client) GetServiceStreamByChannel(ctx context.Context, typ string, channel string, sid int, decode bool) (io.ReadCloser, *http.Response, error)
GetServiceStreamByChannel fetches a service stream for the specified channel.
Example ¶
package main import ( "context" "fmt" "io" "log" "os" "time" "ykzts.com/x/mirakurun" ) func main() { filename := fmt.Sprintf("/tmp/stream-%d.ts", time.Now().Unix()) file, err := os.Create(filename) if err != nil { log.Fatal(err) } c := mirakurun.NewClient() ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() stream, _, err := c.GetServiceStreamByChannel(ctx, "GR", "16", 3239123608, true) if err != nil { log.Fatal(err) } defer stream.Close() fmt.Println("output: ", filename) io.Copy(file, stream) }
Output:
func (*Client) GetServices ¶
func (c *Client) GetServices(ctx context.Context, opt *ServicesListOptions) ([]*Service, *http.Response, error)
GetServices lists the services.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() services, _, err := c.GetServices(context.Background(), nil) if err != nil { log.Fatal(err) } for _, service := range services { fmt.Printf("%d: %s\n", service.ID, service.Name) } }
Output:
func (*Client) GetServicesByChannel ¶
func (c *Client) GetServicesByChannel(ctx context.Context, typ string, channel string) ([]*Service, *http.Response, error)
GetServicesByChannel lists the services for the specified channel.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() services, _, err := c.GetServicesByChannel(context.Background(), "GR", "16") if err != nil { log.Fatal(err) } for _, service := range services { fmt.Printf("%d: %s\n", service.ID, service.Name) } }
Output:
func (*Client) GetStatus ¶
GetStatus fetches a status.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() status, _, err := c.GetStatus(context.Background()) if err != nil { log.Fatal(err) } fmt.Println("Version: " + status.Version) }
Output:
func (*Client) GetTuner ¶
GetTuner fetches a tuner.
Example ¶
package main import ( "context" "fmt" "log" "strings" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() tuner, _, err := c.GetTuner(context.Background(), 1) if err != nil { log.Fatal(err) } fmt.Printf("%d: %s (%s)\n", tuner.Index, tuner.Name, strings.Join(tuner.Types, ", ")) }
Output:
func (*Client) GetTunerProcess ¶
func (c *Client) GetTunerProcess(ctx context.Context, index int) (*TunerProcess, *http.Response, error)
GetTunerProcess fetches a tuner process.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() process, _, err := c.GetTunerProcess(context.Background(), 1) if err != nil { log.Fatal(err) } fmt.Println("PID: ", process.PID) }
Output:
func (*Client) GetTuners ¶
GetTuners lists the tuners.
Example ¶
package main import ( "context" "fmt" "log" "strings" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() tuners, _, err := c.GetTuners(context.Background()) if err != nil { log.Fatal(err) } for _, tuner := range tuners { fmt.Printf("%d: %s (%s)\n", tuner.Index, tuner.Name, strings.Join(tuner.Types, ", ")) } }
Output:
func (*Client) GetTunersConfig ¶
GetTunersConfig fetches a tuners config.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() config, _, err := c.GetTunersConfig(context.Background()) if err != nil { log.Fatal(err) } for _, cItem := range config { fmt.Printf("%s: %v\n", cItem.Name, cItem.IsDisabled) } }
Output:
func (*Client) KillTunerProcess ¶
func (c *Client) KillTunerProcess(ctx context.Context, index int) (*TunerProcess, *http.Response, error)
KillTunerProcess kills a tuner process.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() process, _, err := c.KillTunerProcess(context.Background(), 1) if err != nil { log.Fatal(err) } fmt.Println("PID: ", process.PID) }
Output:
func (*Client) NewRequest ¶
NewRequest creates an API request.
func (*Client) Restart ¶
Restart a Mirakurun process.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() restart, _, err := c.Restart(context.Background()) if err != nil { log.Fatal(err) } fmt.Println("PID: ", restart.PID) }
Output:
func (*Client) UpdateChannelsConfig ¶
func (c *Client) UpdateChannelsConfig(ctx context.Context, body ChannelsConfig) (ChannelsConfig, *http.Response, error)
UpdateChannelsConfig updates a channels config.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() body := mirakurun.ChannelsConfig{ &mirakurun.ChannelConfig{Name: "Test Channel", Type: "GR", Channel: "16"}, } config, _, err := c.UpdateChannelsConfig(context.Background(), body) if err != nil { log.Fatal(err) } for _, cItem := range config { fmt.Printf("%s: %v\n", cItem.Name, cItem.IsDisabled) } }
Output:
func (*Client) UpdateServerConfig ¶
func (c *Client) UpdateServerConfig(ctx context.Context, body *ServerConfig) (*ServerConfig, *http.Response, error)
UpdateServerConfig updates a server config.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() body := &mirakurun.ServerConfig{Port: 14772} config, _, err := c.UpdateServerConfig(context.Background(), body) if err != nil { log.Fatal(err) } fmt.Printf(":%d%s\n", config.Port, config.Path) }
Output:
func (*Client) UpdateTunersConfig ¶
func (c *Client) UpdateTunersConfig(ctx context.Context, body TunersConfig) (TunersConfig, *http.Response, error)
UpdateTunersConfig updates a tuners config.
Example ¶
package main import ( "context" "fmt" "log" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() body := mirakurun.TunersConfig{ &mirakurun.TunerConfig{Name: "Test Tuner", Types: []string{"BS", "CS"}}, } config, _, err := c.UpdateTunersConfig(context.Background(), body) if err != nil { log.Fatal(err) } for _, cItem := range config { fmt.Printf("%s: %v\n", cItem.Name, cItem.IsDisabled) } }
Output:
func (*Client) UpdateVersion ¶
func (c *Client) UpdateVersion(ctx context.Context, opt *VersionUpdateOptions) (io.ReadCloser, *http.Response, error)
UpdateVersion updates a Mirakurun version.
Example ¶
package main import ( "context" "io" "log" "os" "ykzts.com/x/mirakurun" ) func main() { c := mirakurun.NewClient() stream, _, err := c.UpdateVersion(context.Background(), nil) if err != nil { log.Fatal(err) } defer stream.Close() io.Copy(os.Stdout, stream) }
Output:
type DecodeOptions ¶
type DecodeOptions struct {
Decode int `url:"decode,omitempty"`
}
DecodeOptions specifies the optional parameters to various Stream method that support decoding.
type EPGStatus ¶
type EPGStatus struct { GatheringNetworks []int `json:"gatheringNetworks"` StoredEvents int `json:"storedEvents"` }
EPGStatus represents a Mirakurun EPG status.
type Event ¶
type Event struct { Resource string `json:"resource"` Type string `json:"type"` Data interface{} `json:"data"` Time Timestamp `json:"time"` }
Event represents a Mirakurun event.
type EventsListOptions ¶
type EventsListOptions struct { Resource string `url:"resource,omitempty"` Type string `url:"type,omitempty"` }
EventsListOptions specifies the optional parameters to the Client.GetEventsStream method.
type ProcessStatus ¶
type ProcessStatus struct { Arch string `json:"arch"` Platform string `json:"platform"` Versions map[string]string `json:"versions"` PID int `json:"pid"` MemoryUsage map[string]int `json:"memoryUsage"` }
ProcessStatus represents a Mirakurun process status.
type Program ¶
type Program struct { ID int `json:"id"` EventID int `json:"eventId"` ServiceID int `json:"serviceId"` NetworkID int `json:"networkId"` StartAt Timestamp `json:"startAt"` Duration int `json:"duration"` IsFree bool `json:"isFree"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Genres []ProgramGenre `json:"genres,omitempty"` Video ProgramVideo `json:"video,omitempty"` Audio ProgramAudio `json:"audio,omitempty"` Series ProgramSeries `json:"series,omitempty"` Extended map[string]string `json:"extended,omitempty"` RelatedItems []ProgramRelatedItem `json:"relatedItems,omitempty"` }
Program represents a Mirakurun program.
type ProgramAudio ¶
type ProgramAudio struct { SamplingRate int `json:"samplingRate"` ComponentType int `json:"componentType"` }
ProgramAudio represents a Mirakurun program audio.
type ProgramGenre ¶
type ProgramGenre struct { Level1 int `json:"lv1"` Level2 int `json:"lv2"` UserNibble1 int `json:"un1"` UserNibble2 int `json:"un2"` }
ProgramGenre represents a Mirakurun program genre.
type ProgramRelatedItem ¶
type ProgramRelatedItem struct { NetworkID int `json:"networkId"` ServiceID int `json:"serviceId"` EventID int `json:"eventId"` }
ProgramRelatedItem represents a Mirakurun program related item.
type ProgramSeries ¶
type ProgramSeries struct { ID int `json:"id"` Repeat int `json:"repeat"` Pattern int `json:"pattern"` ExpiresAt Timestamp `json:"expiresAt"` Episode int `json:"episode"` LastEpisode int `json:"lastEpisode"` Name string `json:"name"` }
ProgramSeries represents a Mirakurun program series.
type ProgramVideo ¶
type ProgramVideo struct { Type string `json:"type"` Resolution string `json:"resolution"` StreamContent int `json:"streamContent"` ComponentType int `json:"componentType"` }
ProgramVideo represents a Mirakurun program video.
type ProgramsListOptions ¶
type ProgramsListOptions struct { NetworkID int `url:"networkId,omitempty"` ServiceID int `url:"serviceId,omitempty"` EventID int `url:"eventId,omitempty"` }
ProgramsListOptions ...
type RestartResponse ¶
type RestartResponse struct {
PID int `json:"_cmd_pid"`
}
RestartResponse represents a Mirakurun restart response.
type ServerConfig ¶
type ServerConfig struct { Path string `json:"path,omitempty"` Port int `json:"port,omitempty"` DisableIPv6 bool `json:"disableIPv6,omitempty"` LogLevel int `json:"logLevel,omitempty"` MaxLogHistory int `json:"maxLogHistory,omitempty"` HighWaterMark int `json:"highWaterMark,omitempty"` OverflowTimeLimit int `json:"overflowTimeLimit,omitempty"` MaxBufferBytesBeforeReady int `json:"maxBufferBytesBeforeReady,omitempty"` EventEndTimeout int `json:"eventEndTimeout,omitempty"` ProgramGCInterval int `json:"programGCInterval,omitempty"` EPGGatheringInterval int `json:"epgGatheringInterval,omitempty"` EPGRetrievalTime int `json:"epgRetrievalTime,omitempty"` }
ServerConfig represents a Mirakurun server config.
type Service ¶
type Service struct { ID int `json:"id"` ServiceID int `json:"serviceId"` NetworkID int `json:"networkId"` Name string `json:"name"` LogoID int `json:"logoId,omitempty"` HasLogoData bool `json:"hasLogoData,omitempty"` RemoteControlKeyID int `json:"remoteControlKeyId,omitempty"` Channel Channel `json:"channel,omitempty"` }
Service represents a Mirakurun service.
type ServicesListOptions ¶
type ServicesListOptions struct { ServiceID int `url:"serviceId,omitempty"` NetworkID int `url:"networkId,omitempty"` Name string `url:"name,omitempty"` Type int `url:"type,omitempty"` ChannelType string `url:"channel.type,omitempty"` Channel string `url:"channel.channel,omitempty"` }
ServicesListOptions specifies the optional parameters to the Client.GetServices method.
type Status ¶
type Status struct { Version string `json:"version"` Process ProcessStatus `json:"process"` EPG EPGStatus `json:"epg"` StreamCount map[string]int `json:"streamCount"` ErrorCount map[string]int `json:"errorCount"` TimerAccuracy TimerAccuracyStatus `json:"timerAccuracy"` }
Status represents a Mirakurun status.
type TimerAccuracyStatus ¶
type TimerAccuracyStatus struct { Last float64 `json:"last"` M1 map[string]float64 `json:"m1"` M5 map[string]float64 `json:"m5"` M15 map[string]float64 `json:"m15"` }
TimerAccuracyStatus represents a Mirakurun time accuracy status.
type Timestamp ¶
Timestamp represents a Mirakurun timestamp.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type TunerConfig ¶
type TunerConfig struct { Name string `json:"name"` Types []string `json:"types"` Command string `json:"command,omitempty"` DVBDevicePath string `json:"dvbDevicePath,omitempty"` Decoder string `json:"decoder,omitempty"` IsDisabled bool `json:"isDisabled,omitempty"` }
TunerConfig represents a Mirakurun tuner config.
type TunerDevice ¶
type TunerDevice struct { Index int `json:"index"` Name string `json:"name"` Types []string `json:"types"` Command string `json:"command"` PID int `json:"pid"` Users []TunerUser `json:"users"` IsAvailable bool `json:"isAvailable"` IsFree bool `json:"isFree"` IsUsing bool `json:"isUsing"` IsFault bool `json:"isFault"` }
TunerDevice represents a Mirakurun tuner device.
type TunerProcess ¶
type TunerProcess struct {
PID int `json:"pid"`
}
TunerProcess represents a Mirakurun tuner process.
type TunerUser ¶
type TunerUser struct { ID string `json:"id"` Priority int `json:"priority"` Agent string `json:"agent,omitempty"` }
TunerUser represents a Mirakurun tuner user.
type TunersConfig ¶
type TunersConfig []*TunerConfig
TunersConfig represents a Mirakurun tuners config.
type VersionUpdateOptions ¶
type VersionUpdateOptions struct {
Force bool `url:"force,omitempty"`
}
VersionUpdateOptions specifies the optional parameters to the Client.UpdateVersion method.