def get_status(): camera = current_app.get_camera() message = {"camera": camera.has_camera} if (message["camera"] == False): message["error"] = RemoteDslrApiError.translate( camera.get_last_error()) return current_app.success_response(message)
def key_value(key): camera = current_app.get_camera() data = json.loads(request.data) value = __validate_value(data) camera.set_config_value(key, value) return current_app.success_response({}), 201
def shutter_speed(): camera = current_app.get_camera() data = json.loads(request.data) value = __validate_value(data) camera.set_config_value("shutterspeed2", value) return current_app.success_response({}), 201
def capture(): camera = current_app.get_camera() data = json.loads(request.data) with_image = False if ('with_image' in data): with_image = data["with_image"] image = camera.capture(with_image) if (with_image): return current_app.success_response(image.serialize), 200 return current_app.success_response({"path": image.path}), 200
def start_live_view(): camera = current_app.get_camera() def frame_build(): camera.start_preview() while camera.preview_running: frame = camera.read_liveview_frame() # another command will be executed # so we can wait a little bit more if (frame == False or camera.is_busy): sleep(0.5) continue yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n') sleep(1. / 25) return Response(frame_build(), mimetype='multipart/x-mixed-replace; boundary=frame')
def aperture(): camera = current_app.get_camera() data = json.loads(request.data) value = __validate_value(data) camera.set_config_value("f-number", value) return current_app.success_response({}), 201
def get_config_by_key(key): camera = current_app.get_camera() data = str(key).split(",") return current_app.success_response(camera.get_config_value(data)), 200
def list_config(): camera = current_app.get_camera() return current_app.success_response(camera.get_config()), 200
def fs_previews(): camera = current_app.get_camera() data = json.loads(request.data) value = __validate_value(data) previews = camera.read_file(value) return current_app.success_response({"file": previews}), 200
def fs_list(): camera = current_app.get_camera() fs = camera.read_folder('/') return current_app.success_response({"fs": fs}), 200
def stop_live_view(): camera = current_app.get_camera() camera.stop_preview() return current_app.success_response({}), 200
def focus_manual(): camera = current_app.get_camera() camera.auto_focus() return current_app.success_response({}), 200
def focus_manual(): camera = current_app.get_camera() data = json.loads(request.data) value = __validate_value(data) camera.manual_focus(value) return current_app.success_response({}), 200
def get_summary(): camera = current_app.get_camera() return current_app.success_response({"summary": camera.get_summary()}), 200