supervisorconf + fixes

This commit is contained in:
Artwork1 2018-01-05 00:04:52 +01:00
parent 1a38065a08
commit 4e1a633ba0
2 changed files with 51 additions and 42 deletions

View file

@ -89,6 +89,7 @@ log = open(logfile, "a")
lastFaceTime = datetime.datetime.utcnow() lastFaceTime = datetime.datetime.utcnow()
while True: while True:
try:
print(time.time(),"GO") print(time.time(),"GO")
start = datetime.datetime.utcnow() start = datetime.datetime.utcnow()
stream = io.BytesIO() stream = io.BytesIO()
@ -114,11 +115,10 @@ while True:
log.write("{},{},{}\n".format(time.time(), len(faces), int(totalUse))) log.write("{},{},{}\n".format(time.time(), len(faces), int(totalUse)))
log.flush() log.flush()
content = urllib2.urlopen("https://artstats.rubenvandeven.com/artwork1/views.php?time=%d&count=%d&total=%d" % (int(time.time()), len(faces), int(totalUse)) ).read()
os.fsync(log.fileno()) os.fsync(log.fileno())
if len(faces) < 1 and end - lastFaceTime > dimTimeDelta: if len(faces) < 1 and end - lastFaceTime > dimTimeDelta:
lcd.set_backlight(0) lcd.set_backlight(0)
else: else:
@ -127,12 +127,16 @@ while True:
if len(faces) > 0: if len(faces) > 0:
lastFaceTime = end lastFaceTime = end
content = urllib2.urlopen("https://artstats.rubenvandeven.com/artwork1/views.php?time=%d&count=%d&total=%d" % (int(time.time()), len(faces), int(totalUse)) ).read()
#~ if end - start < frameTimeDelta: #~ if end - start < frameTimeDelta:
#~ waitTime = frameTimeDelta - (end-start) #~ waitTime = frameTimeDelta - (end-start)
#~ print("wait {}".waitTime.total_seconds()) #~ print("wait {}".waitTime.total_seconds())
#~ time.sleep(waitTime.total_seconds()) #~ time.sleep(waitTime.total_seconds())
except Exception as e:
print e

5
supervisord.conf Normal file
View file

@ -0,0 +1,5 @@
[program:scan_faces]
directory=/home/pi/scan_faces
command=/usr/bin/python /home/pi/scan_faces/scan_faces.py
user=pi
autorestart=true