Skip to content

Commit

Permalink
discard deleted files after an hour
Browse files Browse the repository at this point in the history
  • Loading branch information
TinkerTurtle committed Feb 19, 2022
1 parent 24e8987 commit dc8a511
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
const ProductName = "sentry-picam"

// ProductVersion #
const ProductVersion = "0.7.3"
const ProductVersion = "0.7.4"

var clients = make(map[*websocket.Conn]bool)
var clientsMotion = make(map[*websocket.Conn]bool)
Expand Down
2 changes: 1 addition & 1 deletion pkg/raspivid/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (conv *Converter) convertFile(name string) {
delete(conv.highlightCache, name)

os.Remove(conv.folder + "raw/" + name + ".h264")
log.Println("File written: ", name, "Offset:", skip)
//log.Println("File written: ", name, "Offset:", skip)

if conv.TriggerScript != "" {
cmd = exec.Command("nice", "-19",
Expand Down
2 changes: 1 addition & 1 deletion recordingList.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (rec *RecordingList) handleDestroyRecording(w http.ResponseWriter, r *http.
s := strings.Split(f.Name(), "_")

videoTime, _ := time.Parse("2006-01-02-1504", s[0])
if time.Now().Add(-time.Hour * 24 * 7).After(videoTime) {
if time.Now().Add(-time.Hour).After(videoTime) {
os.Remove(rec.Folder + "deleteme/" + f.Name())
}
}
Expand Down
Binary file modified sentry-picam
Binary file not shown.

0 comments on commit dc8a511

Please sign in to comment.