()
| 343 | @api.route("/printer/sd", methods=["POST"]) |
| 344 | @restricted_access |
| 345 | def printerSdCommand(): |
| 346 | if not settings().getBoolean(["feature", "sdSupport"]): |
| 347 | return make_response("SD support is disabled", 404) |
| 348 | |
| 349 | pm = printerManager() |
| 350 | |
| 351 | if not pm.isOperational() or pm.isPrinting() or pm.isPaused(): |
| 352 | return make_response("Printer is not operational or currently busy", 409) |
| 353 | |
| 354 | valid_commands = { |
| 355 | "init": [], |
| 356 | "refresh": [], |
| 357 | "release": [] |
| 358 | } |
| 359 | command, data, response = util.getJsonCommandFromRequest(request, valid_commands) |
| 360 | if response is not None: |
| 361 | return response |
| 362 | |
| 363 | if command == "init": |
| 364 | pm.initSdCard() |
| 365 | elif command == "refresh": |
| 366 | pm.refreshSdFiles() |
| 367 | elif command == "release": |
| 368 | pm.releaseSdCard() |
| 369 | |
| 370 | return NO_CONTENT |
| 371 | |
| 372 | |
| 373 | @api.route("/printer/sd", methods=["GET"]) |
nothing calls this directly
no test coverage detected