Allow adjusting LED time and add time info
This commit is contained in:
parent
8ca4d55045
commit
66f86827ff
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from flask import Flask, request, abort, send_from_directory
|
from flask import Flask, request, abort, send_from_directory
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
|
@ -43,8 +44,11 @@ def clients_post():
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
break
|
break
|
||||||
|
|
||||||
|
content['date'] = datetime.now().strftime('%Y-%m-%d')
|
||||||
|
content['time'] = datetime.now().strftime('%H:%M:%S')
|
||||||
|
|
||||||
path.mkdir()
|
path.mkdir()
|
||||||
info_file = path / 'info.json'
|
info_file = path / 'info.txt'
|
||||||
info_file.touch()
|
info_file.touch()
|
||||||
info_file.write_text(json.dumps(content, indent=4))
|
info_file.write_text(json.dumps(content, indent=4))
|
||||||
|
|
||||||
|
@ -61,7 +65,7 @@ def clients_get(cid):
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
info_file = path / 'info.json'
|
info_file = path / 'info.txt'
|
||||||
info_text = info_file.read_text()
|
info_text = info_file.read_text()
|
||||||
res = json.loads(info_text)
|
res = json.loads(info_text)
|
||||||
photo_glob = path.glob('*.jpg')
|
photo_glob = path.glob('*.jpg')
|
||||||
|
@ -102,6 +106,9 @@ def session_delete(cid):
|
||||||
|
|
||||||
@app.route('/api/clients/<cid>/session', methods=['POST'])
|
@app.route('/api/clients/<cid>/session', methods=['POST'])
|
||||||
def session_post(cid):
|
def session_post(cid):
|
||||||
|
content = request.json
|
||||||
|
light_time = content.get('light_time', 5000)
|
||||||
|
|
||||||
global status
|
global status
|
||||||
|
|
||||||
print('POST session:', cid)
|
print('POST session:', cid)
|
||||||
|
@ -130,19 +137,9 @@ def session_post(cid):
|
||||||
# capture
|
# capture
|
||||||
status = CAPTURING_PHOTO
|
status = CAPTURING_PHOTO
|
||||||
power.lights_on()
|
power.lights_on()
|
||||||
time.sleep(0.25)
|
time.sleep(0.1)
|
||||||
capture.trigger_capture()
|
capture.trigger_capture()
|
||||||
time.sleep(2)
|
time.sleep(light_time / 1000)
|
||||||
|
|
||||||
#status = CAPTURING_GRID
|
|
||||||
#power.grid_on()
|
|
||||||
#time.sleep(2)
|
|
||||||
#capture.trigger_capture()
|
|
||||||
#time.sleep(2)
|
|
||||||
#power.grid_off()
|
|
||||||
|
|
||||||
status = WRITING
|
|
||||||
time.sleep(3)
|
|
||||||
power.lights_off()
|
power.lights_off()
|
||||||
|
|
||||||
status = DOWNLOADING
|
status = DOWNLOADING
|
||||||
|
|
Loading…
Reference in New Issue
Block a user