fix incompatible file names (android wtf?)
This commit is contained in:
parent
1dd43417c7
commit
81e35d46b8
7
main.go
7
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user