fixed a bug where the last moment wasn't added to the moment list

This commit is contained in:
BroodjeAap 2020-08-18 18:39:26 +00:00
parent 0c7a34db51
commit e1e4df6ad5

View file

@ -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
// Was used, and motion was therefore detected.
timeDifference := currentTime.Sub(previousTime)
if timeDifference < (time.Duration(stream.Interval) * time.Millisecond) {
lessThenInterval := timeDifference < (time.Duration(stream.Interval) * time.Millisecond)
if lessThenInterval {
foundMoment = true
currentMoment = append(currentMoment, previousImage.Name())
} else {
}
if !lessThenInterval || i == len(images) {
if foundMoment {
currentMoment = append(currentMoment, currentImage.Name())
moments = append(moments, currentMoment)