diff --git a/main.go b/main.go index a8b4521..424f356 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,6 @@ var ( ) func init() { - log.Print("storage-security starting") img = gocv.NewMat() imgDelta = gocv.NewMat() @@ -48,8 +47,8 @@ func main() { log.Fatalf("error opening log file: %v", err) } defer f.Close() - log.SetOutput(f) + log.Print("storage-security starting") webcam, err := gocv.OpenVideoCapture(deviceID) if err != nil { @@ -84,8 +83,8 @@ func main() { if frameCount >= motionDetectInterval { if detectMotion(img) { // Determine if a new recording needs to start - if time.Now().After(lastMotionDetectedTime.Add(time.Second * recordLengthAfterMotion)) { - fileName := fmt.Sprintf("%s/storage-security-%s.avi", syncFolder, time.Now().Format(time.RFC3339)) + 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")) 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 {