def sdCommand(): if not settings().getBoolean(["feature", "sdSupport"]) or not printer.isOperational() or printer.isPrinting(): return jsonify(SUCCESS) if "command" in request.values.keys(): command = request.values["command"] if command == "init": printer.initSdCard() elif command == "refresh": printer.refreshSdFiles() elif command == "release": printer.releaseSdCard() return jsonify(SUCCESS)
def sdCommand(): if not settings().getBoolean([ "feature", "sdSupport" ]) or not printer.isOperational() or printer.isPrinting(): return jsonify(SUCCESS) if "command" in request.values.keys(): command = request.values["command"] if command == "init": printer.initSdCard() elif command == "refresh": printer.refreshSdFiles() elif command == "release": printer.releaseSdCard() return jsonify(SUCCESS)
def printerSdCommand(): if not settings().getBoolean(["feature", "sdSupport"]): return make_response("SD support is disabled", 404) if not printer.isOperational() or printer.isPrinting() or printer.isPaused(): return make_response("Printer is not operational or currently busy", 409) valid_commands = {"init": [], "refresh": [], "release": []} command, data, response = util.getJsonCommandFromRequest(request, valid_commands) if response is not None: return response if command == "init": printer.initSdCard() elif command == "refresh": printer.refreshSdFiles() elif command == "release": printer.releaseSdCard() return NO_CONTENT
def sdCommand(): if not settings().getBoolean(["feature", "sdSupport"]) or not printer.isOperational() or printer.isPrinting(): return make_response("SD support is disabled", 403) valid_commands = { "init": [], "refresh": [], "release": [] } command, data, response = util.getJsonCommandFromRequest(request, valid_commands) if response is not None: return response if command == "init": printer.initSdCard() elif command == "refresh": printer.refreshSdFiles() elif command == "release": printer.releaseSdCard() return jsonify(SUCCESS)
def printerSdCommand(): if not settings().getBoolean(["feature", "sdSupport"]): return make_response("SD support is disabled", 404) if not printer.isOperational() or printer.isPrinting() or printer.isPaused( ): return make_response("Printer is not operational or currently busy", 409) valid_commands = {"init": [], "refresh": [], "release": []} command, data, response = util.getJsonCommandFromRequest( request, valid_commands) if response is not None: return response if command == "init": printer.initSdCard() elif command == "refresh": printer.refreshSdFiles() elif command == "release": printer.releaseSdCard() return NO_CONTENT