added a map of area name -> area list to Stream
This commit is contained in:
parent
409556604e
commit
f71fb6a14a
1 changed files with 20 additions and 4 deletions
24
stream.go
24
stream.go
|
@ -17,10 +17,11 @@ import (
|
||||||
|
|
||||||
// Stream Unexported
|
// Stream Unexported
|
||||||
type Stream struct {
|
type Stream struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Base64 string `json:"base64"`
|
Base64 string `json:"base64"`
|
||||||
Interval int `json:"interval"`
|
Interval int `json:"interval"`
|
||||||
FileLock sync.Mutex `json:"lock"`
|
Areas map[string][]image.Rectangle `json:"areas"`
|
||||||
|
FileLock sync.Mutex `json:"lock"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStream creates a new Stream Object
|
// NewStream creates a new Stream Object
|
||||||
|
@ -31,7 +32,22 @@ func NewStream(URL string) Stream {
|
||||||
URL: URL,
|
URL: URL,
|
||||||
Base64: base64,
|
Base64: base64,
|
||||||
Interval: 5000,
|
Interval: 5000,
|
||||||
|
Areas: make(map[string][]image.Rectangle),
|
||||||
}
|
}
|
||||||
|
rectList := make([]image.Rectangle, 0)
|
||||||
|
rectList = append(rectList, image.Rectangle{
|
||||||
|
Min: image.Point{X: 30, Y: 30},
|
||||||
|
Max: image.Point{X: 400, Y: 200},
|
||||||
|
})
|
||||||
|
rectList = append(rectList, image.Rectangle{
|
||||||
|
Min: image.Point{X: 500, Y: 30},
|
||||||
|
Max: image.Point{X: 400, Y: 200},
|
||||||
|
})
|
||||||
|
rectList = append(rectList, image.Rectangle{
|
||||||
|
Min: image.Point{X: 500, Y: 500},
|
||||||
|
Max: image.Point{X: 400, Y: 200},
|
||||||
|
})
|
||||||
|
stream.Areas["test"] = rectList
|
||||||
stream.WriteStreamJSON()
|
stream.WriteStreamJSON()
|
||||||
return stream
|
return stream
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue