From 2a36149c766e7473531ca73560ddf54a50b24296 Mon Sep 17 00:00:00 2001 From: Ricardosgeral Date: Tue, 26 Feb 2019 10:32:51 +0000 Subject: [PATCH] add delete images in time-lapse --- camera_timelapse.py | 11 ++++++++--- main.py | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/camera_timelapse.py b/camera_timelapse.py index 43b893e..ffc5974 100644 --- a/camera_timelapse.py +++ b/camera_timelapse.py @@ -9,8 +9,7 @@ import threading import datetime, subprocess, os -from time import sleep - +import re class capture(threading.Thread): def __init__(self, picsLocation, testname, testtype, elapsed, flowrate): @@ -42,4 +41,10 @@ def CaptureImage(self): pass def run(self): - self.CaptureImage() \ No newline at end of file + self.CaptureImage() + + +def delImages(picsLocation): + for f in os.listdir(picsLocation): + if re.search(".jpg", f): # if the file has the extension .jpg + os.remove(os.path.join(picsLocation, f)) #remove the file \ No newline at end of file diff --git a/main.py b/main.py index 4e98ed6..210bacb 100644 --- a/main.py +++ b/main.py @@ -437,8 +437,7 @@ def read_display_write(e_rdw): # read and display data in page "record" and writ if delImages == 1: # delete images - #todo - pass + cm.delImages(picsLocation) # disconnect from database test_end() # morse code sounds to alert for final test