From e1e4df6ad5fc2233aa319e4ec8cae73ce2c52ec7 Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Tue, 18 Aug 2020 18:39:26 +0000 Subject: [PATCH] fixed a bug where the last moment wasn't added to the moment list --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 177fabd..72692f2 100755 --- a/main.go +++ b/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 // 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)