def init_run(m_app): #misc.runCmd("killall PTPCamera") // only for mac #settings.load_settings() #settings.update_setting('port',8080) misc.runProc(settings.cmd_init) # gphoto2 --auto-detect m_app.add_url_rule('/', 'index', requests.index) m_app.add_url_rule('/get_picture', 'get_picture', requests.get_picture) m_app.add_url_rule('/get_preview', 'get_preview', requests.get_preview) m_app.add_url_rule('/take_picture','take_picture',requests.take_picture) m_app.add_url_rule('/stream' ,'stream' ,requests.getLastPreview) m_app.run(host = "0.0.0.0",port = 8080) #settings.g_port
def take_picture(): # take picture and return stdout out = misc.runProc(settings.cmd_base + settings.p_take_image) fileName = misc.findFileNameByExt(out,'jpg') if(fileName != 'None'): settings.update_l_picture(fileName) return send_file(fileName) else: return 'Camera Error'
def get_preview(): # take and return preview misc.runProc(settings.cmd_base + settings.p_take_preview) return send_file("preview.jpg")
def get_setting(setting): out = misc.runProc(settings.cmd_base + settings.p_get_setting + setting) return out
def set_setting(setting, value): out = misc.runProc(settings.cmd_base + settings.p_set_setting + setting + '=' + value) return out
def print_info(m_app): output = misc.runProc('ls')
def get_preview(): # take and return preview #set_setting("eosremoterelease","5") misc.runProc(settings.cmd_base + settings.p_take_preview) #misc.runSCmd(settings.cmd_base, settings.p_take_preview); return send_file("thumb_preview.jpg")