fixed a bug where the last moment wasn't added to the moment list
This commit is contained in:
parent
0c7a34db51
commit
e1e4df6ad5
1 changed files with 4 additions and 2 deletions
6
main.go
6
main.go
|
|
@ -246,10 +246,12 @@ func (server Server) streamRecordings(w http.ResponseWriter, r *http.Request) {
|
||||||
// if the time difference is lower then the Stream.Interval, it means the Stream.MotionInterval
|
// if the time difference is lower then the Stream.Interval, it means the Stream.MotionInterval
|
||||||
// Was used, and motion was therefore detected.
|
// Was used, and motion was therefore detected.
|
||||||
timeDifference := currentTime.Sub(previousTime)
|
timeDifference := currentTime.Sub(previousTime)
|
||||||
if timeDifference < (time.Duration(stream.Interval) * time.Millisecond) {
|
lessThenInterval := timeDifference < (time.Duration(stream.Interval) * time.Millisecond)
|
||||||
|
if lessThenInterval {
|
||||||
foundMoment = true
|
foundMoment = true
|
||||||
currentMoment = append(currentMoment, previousImage.Name())
|
currentMoment = append(currentMoment, previousImage.Name())
|
||||||
} else {
|
}
|
||||||
|
if !lessThenInterval || i == len(images) {
|
||||||
if foundMoment {
|
if foundMoment {
|
||||||
currentMoment = append(currentMoment, currentImage.Name())
|
currentMoment = append(currentMoment, currentImage.Name())
|
||||||
moments = append(moments, currentMoment)
|
moments = append(moments, currentMoment)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue