Compare commits
No commits in common. "d5cfbafbdeeb0023ed5c38bf710f4629819116d8" and "14395bdbdda06508dba3bddc7debfdef2c6446a3" have entirely different histories.
d5cfbafbde
...
14395bdbdd
|
@ -18,12 +18,10 @@ def download(ip, dest):
|
||||||
|
|
||||||
for f in files:
|
for f in files:
|
||||||
source_file = '/3dscan/' + f
|
source_file = '/3dscan/' + f
|
||||||
dest_file = dest / (f + '.tmp')
|
dest_file = dest / f
|
||||||
print('Grabbing file', source_file)
|
print('Grabbing file', source_file)
|
||||||
sftp.get(source_file, dest_file)
|
sftp.get(source_file, dest_file)
|
||||||
sftp.remove(source_file)
|
#sftp.remove(source_file)
|
||||||
done_file = dest / f
|
|
||||||
dest_file.rename(done_file)
|
|
||||||
|
|
||||||
if sftp: sftp.close()
|
if sftp: sftp.close()
|
||||||
if transport: transport.close()
|
if transport: transport.close()
|
||||||
|
|
|
@ -12,12 +12,6 @@ output_folder = Path('./output')
|
||||||
app = Flask(__name__, static_folder=str(build_folder), static_url_path='')
|
app = Flask(__name__, static_folder=str(build_folder), static_url_path='')
|
||||||
CORS(app)
|
CORS(app)
|
||||||
|
|
||||||
status = 'Standby'
|
|
||||||
|
|
||||||
@app.route('/api/status', methods=['GET'])
|
|
||||||
def status_get():
|
|
||||||
return {'status': status}
|
|
||||||
|
|
||||||
@app.route('/api/clients', methods=['POST'])
|
@app.route('/api/clients', methods=['POST'])
|
||||||
def clients_post():
|
def clients_post():
|
||||||
content = request.json
|
content = request.json
|
||||||
|
@ -67,7 +61,7 @@ def session_get(cid):
|
||||||
|
|
||||||
photo_glob = path.glob('*.jpg')
|
photo_glob = path.glob('*.jpg')
|
||||||
res = {}
|
res = {}
|
||||||
res['photos'] = sorted([x.name for x in photo_glob])
|
res['photos'] = [x.name for x in photo_glob]
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -88,8 +82,6 @@ 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):
|
||||||
global status
|
|
||||||
|
|
||||||
folder = cid
|
folder = cid
|
||||||
path = output_folder / cid
|
path = output_folder / cid
|
||||||
|
|
||||||
|
@ -97,7 +89,6 @@ def session_post(cid):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
# go through the photo taking process
|
# go through the photo taking process
|
||||||
status = 'Warming up'
|
|
||||||
|
|
||||||
# warmup
|
# warmup
|
||||||
power.lights_on()
|
power.lights_on()
|
||||||
|
@ -105,8 +96,6 @@ def session_post(cid):
|
||||||
power.lights_off()
|
power.lights_off()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
status = 'Capturing'
|
|
||||||
|
|
||||||
# capture
|
# capture
|
||||||
power.lights_on()
|
power.lights_on()
|
||||||
time.sleep(0.25)
|
time.sleep(0.25)
|
||||||
|
@ -119,23 +108,14 @@ def session_post(cid):
|
||||||
power.grid_off()
|
power.grid_off()
|
||||||
power.lights_off()
|
power.lights_off()
|
||||||
|
|
||||||
status = 'Writing to files'
|
|
||||||
time.sleep(3)
|
|
||||||
|
|
||||||
status = 'Downloading'
|
|
||||||
download.download_all_photos(path)
|
download.download_all_photos(path)
|
||||||
|
|
||||||
status = 'Standby'
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
return app.send_static_file('index.html')
|
return app.send_static_file('index.html')
|
||||||
|
|
||||||
@app.errorhandler(404)
|
|
||||||
def not_found(e):
|
|
||||||
return app.send_static_file('index.html')
|
|
||||||
|
|
||||||
@app.route('/output/<path:filename>')
|
@app.route('/output/<path:filename>')
|
||||||
def output(filename):
|
def output(filename):
|
||||||
return send_from_directory('output/', filename)
|
return send_from_directory('output/', filename)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user