Merge branch 'master' of https://git.tannercollin.com/tanner/3Dshock
This commit is contained in:
commit
fa6809b507
|
@ -5,7 +5,17 @@ import paramiko
|
||||||
import time
|
import time
|
||||||
paramiko.util.log_to_file('paramiko.log')
|
paramiko.util.log_to_file('paramiko.log')
|
||||||
|
|
||||||
|
def fake_download(dest):
|
||||||
|
import requests, random
|
||||||
|
rnd = str(random.randint(1, 10000))
|
||||||
|
r = requests.get('https://picsum.photos/400/300?random=' + rnd)
|
||||||
|
with open(dest / (rnd + '.jpg'), 'wb') as f:
|
||||||
|
f.write(r.content)
|
||||||
|
|
||||||
def download(ip, dest):
|
def download(ip, dest):
|
||||||
|
if settings.DEBUG:
|
||||||
|
fake_download(dest)
|
||||||
|
|
||||||
print('Downloading from', ip)
|
print('Downloading from', ip)
|
||||||
|
|
||||||
port = 22
|
port = 22
|
||||||
|
|
|
@ -26,7 +26,7 @@ def clients_post():
|
||||||
phone = str(content['phone'])
|
phone = str(content['phone'])
|
||||||
|
|
||||||
for i in range(1, 100):
|
for i in range(1, 100):
|
||||||
suffix = str(i).zfill(3)
|
suffix = str(i).zfill(2)
|
||||||
folder = phone + '_' + suffix
|
folder = phone + '_' + suffix
|
||||||
path = output_folder / folder
|
path = output_folder / folder
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
|
@ -99,11 +99,18 @@ def session_post(cid):
|
||||||
# go through the photo taking process
|
# go through the photo taking process
|
||||||
status = 'Warming up'
|
status = 'Warming up'
|
||||||
|
|
||||||
# warmup
|
try:
|
||||||
power.lights_on()
|
# warmup
|
||||||
time.sleep(4)
|
power.lights_on()
|
||||||
power.lights_off()
|
time.sleep(4)
|
||||||
time.sleep(0.5)
|
power.lights_off()
|
||||||
|
time.sleep(0.5)
|
||||||
|
except BaseException as e:
|
||||||
|
print('Problem with lights: {} - {}'.format(e.__class__.__name__, str(e)))
|
||||||
|
print()
|
||||||
|
print('Are you sure the system is connected?')
|
||||||
|
print()
|
||||||
|
abort(500)
|
||||||
|
|
||||||
status = 'Capturing'
|
status = 'Capturing'
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ import settings
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def np_02B_api(ip, username, password, is_on):
|
def np_02B_api(ip, username, password, is_on):
|
||||||
|
if settings.DEBUG: return
|
||||||
|
|
||||||
if is_on:
|
if is_on:
|
||||||
endpoint = '/cmd.cgi?grp=0'
|
endpoint = '/cmd.cgi?grp=0'
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import os
|
||||||
|
DEBUG = os.environ.get('FLASK_ENV', None) == 'development'
|
||||||
|
|
||||||
LIGHT_IP = '192.168.99.25'
|
LIGHT_IP = '192.168.99.25'
|
||||||
LIGHT_USER = 'admin'
|
LIGHT_USER = 'admin'
|
||||||
LIGHT_PASS = 'admin'
|
LIGHT_PASS = 'admin'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user