added a map of area name -> area list to Stream

This commit is contained in:
BroodjeAap 2020-07-11 13:15:00 +00:00
parent 409556604e
commit f71fb6a14a

View file

@ -17,10 +17,11 @@ import (
// Stream Unexported
type Stream struct {
URL string `json:"url"`
Base64 string `json:"base64"`
Interval int `json:"interval"`
FileLock sync.Mutex `json:"lock"`
URL string `json:"url"`
Base64 string `json:"base64"`
Interval int `json:"interval"`
Areas map[string][]image.Rectangle `json:"areas"`
FileLock sync.Mutex `json:"lock"`
}
// NewStream creates a new Stream Object
@ -31,7 +32,22 @@ func NewStream(URL string) Stream {
URL: URL,
Base64: base64,
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()
return stream
}