From 4ba8936fb9db6769d5a386e150f61c4c275ef5fe Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Fri, 30 Oct 2020 00:48:24 +0000 Subject: [PATCH] A little note about insane filesystem restrictions due to arcane standards --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 0e8cff8..f73dfe1 100644 --- a/main.go +++ b/main.go @@ -88,8 +88,8 @@ func main() { if frameCount >= motionDetectInterval { if detectMotion(img) { // Determine if a new recording needs to start, we may already have one running - if time.Now().After(lastMotionDetectedTime.Add(time.Second * recordLengthAfterMotion)) { // - fileName := fmt.Sprintf("%s/storage-security-%s.avi", syncFolder, time.Now().Format("2006-01-02-15-04-05")) + if time.Now().After(lastMotionDetectedTime.Add(time.Second * recordLengthAfterMotion)) { + fileName := fmt.Sprintf("%s/storage-security-%s.avi", syncFolder, time.Now().Format("2006-01-02-15-04-05")) // My preferred timestamp format is RFC3339, however there are weird filesystems out there that don't like colons in the names of files such as NTFS or FAT32. log.Printf("motion detected, started recording to file named %s", fileName) currentRecording, err = gocv.VideoWriterFile(fileName, "MJPG", 25, img.Cols(), img.Rows(), true) if err != nil {