def readGcodeFilesForOrigin(origin): if origin not in [FileDestinations.LOCAL, FileDestinations.SDCARD, FileDestinations.FastbotSDCARD]: return make_response("Unknown origin: %s" % origin, 404) files = _getFileList(origin) print("lkj readGcodeFilesForOrigin origin:%s" % origin ) print("lkj readGcodeFilesForOrigin files:%s" % str(files) ) if origin == FileDestinations.LOCAL: return jsonify(files=files, free=util.getFreeBytes(settings().getBaseFolder("uploads"))) elif origin == FileDestinations.FastbotSDCARD: return jsonify(files=files, sdFree=util.getFreeBytes(fileManager._storage(origin).get_basefolder())) else: return jsonify(files=files)
def readGcodeFiles(): filter = None if "filter" in request.values: filter = request.values["filter"] files = _getFileList(FileDestinations.LOCAL, filter=filter) files.extend(_getFileList(FileDestinations.SDCARD)) return jsonify(files=files, free=util.getFreeBytes(settings().getBaseFolder("uploads")))
def readGcodeFiles(): filter = None if "filter" in request.values: filter = request.values["filter"] if filter is not None: print("lkj readGcodeFiles filter:%s" % repr(filter) ) print("lkj readGcodeFiles request.values:%s" % str(request.values) ) files = _getFileList(FileDestinations.LOCAL, filter=filter) print("lkj 1 readGcodeFiles files:%s" % str(files) ) #lkj files.extend(_getFileList(FileDestinations.SDCARD)) sdFree = 0 if printer.isSdReady(): files.extend(_getFileList(FileDestinations.FastbotSDCARD)) sdFree = util.getFreeBytes(fileManager._storage(FileDestinations.FastbotSDCARD).get_basefolder()) print("lkj 2 readGcodeFiles files:%s, sdFree:%s" % (str(files), str(sdFree)) ) return jsonify(files=files, free=util.getFreeBytes(settings().getBaseFolder("uploads")), sdFree=sdFree)
def readGcodeFilesForOrigin(origin): if origin not in [FileDestinations.LOCAL, FileDestinations.SDCARD]: return make_response("Unknown origin: %s" % origin, 404) files = _getFileList(origin) if origin == FileDestinations.LOCAL: return jsonify(files=files, free=util.getFreeBytes(settings().getBaseFolder("uploads"))) else: return jsonify(files=files)
def readGcodeFilesForOrigin(origin): if origin not in [ FileDestinations.LOCAL, FileDestinations.SDCARD, FileDestinations.FastbotSDCARD ]: return make_response("Unknown origin: %s" % origin, 404) files = _getFileList(origin) print("lkj readGcodeFilesForOrigin origin:%s" % origin) print("lkj readGcodeFilesForOrigin files:%s" % str(files)) if origin == FileDestinations.LOCAL: return jsonify(files=files, free=util.getFreeBytes( settings().getBaseFolder("uploads"))) elif origin == FileDestinations.FastbotSDCARD: return jsonify(files=files, sdFree=util.getFreeBytes( fileManager._storage(origin).get_basefolder())) else: return jsonify(files=files)
def readGcodeFilesForOrigin(origin): if origin not in [FileDestinations.LOCAL, FileDestinations.SDCARD]: return make_response("Unknown origin: %s" % origin, 404) files = _getFileList(origin) if origin == FileDestinations.LOCAL: #modify by kevin, for different path return jsonify(files=files, free=util.getFreeBytes(gcodeManager._uploadFolder)) #modify end else: return jsonify(files=files)
def readGcodeFiles(): files = gcodeManager.getAllFileData() sdFileList = printer.getSdFiles() if sdFileList is not None: for sdFile in sdFileList: files.append({ "name": sdFile, "size": "n/a", "bytes": 0, "date": "n/a", "origin": "sd" }) return jsonify(files=files, free=util.getFormattedSize(util.getFreeBytes(settings.getpath("uploads"))))
def readGcodeFiles(): files = gcodeManager.getAllFileData() sdFileList = printer.getSdFiles() if sdFileList is not None: for sdFile in sdFileList: files.append({ "name": sdFile, "size": "n/a", "bytes": 0, "date": "n/a", "origin": "sd" }) return jsonify(files=files, free=util.getFormattedSize(util.getFreeBytes(settings().getBaseFolder("uploads"))))
def readGcodeFiles(): filter = None if "filter" in request.values: filter = request.values["filter"] if filter is not None: print("lkj readGcodeFiles filter:%s" % repr(filter)) print("lkj readGcodeFiles request.values:%s" % str(request.values)) files = _getFileList(FileDestinations.LOCAL, filter=filter) print("lkj 1 readGcodeFiles files:%s" % str(files)) #lkj files.extend(_getFileList(FileDestinations.SDCARD)) sdFree = 0 if printer.isSdReady(): files.extend(_getFileList(FileDestinations.FastbotSDCARD)) sdFree = util.getFreeBytes( fileManager._storage( FileDestinations.FastbotSDCARD).get_basefolder()) print("lkj 2 readGcodeFiles files:%s, sdFree:%s" % (str(files), str(sdFree))) return jsonify(files=files, free=util.getFreeBytes(settings().getBaseFolder("uploads")), sdFree=sdFree)
def getLocalFiles(self, sendResponse): try: try: files = self._getLocalFileList(FileDestinations.LOCAL) except: pass try: files.extend(self._getLocalFileList(FileDestinations.SDCARD)) except: pass sendResponse( { 'files': files, 'free': util.getFreeBytes(settings().getBaseFolder("uploads")) }) except Exception as e: self._logger.error("files can not be obtained", exc_info = True) sendResponse('no_files_obtained',True)
def changeFilesPath(): #modify by kevin, for use json format if not "application/json" in request.headers["Content-Type"]: return make_response("Expected content type JSON", 400) data = request.json if "filespath" in data.keys(): if "local" == data["filespath"]: gcodeManager._uploadFolder = gcodeManager._localpath elif "usb" == data["filespath"]: gcodeManager._uploadFolder = gcodeManager._usbpath #modify end if "returnFiles" in data.keys() and data.get("returnFiles") is True: files = _getFileList(FileDestinations.LOCAL) files.extend(_getFileList(FileDestinations.SDCARD)) return jsonify(files=files, free=util.getFreeBytes(gcodeManager._uploadFolder)) return NO_CONTENT
def getLogFiles(): files = _getLogFiles() return jsonify(files=files, free=getFreeBytes(settings().getBaseFolder("logs")))
def getUpdateFiles(): return jsonify(files=_getUpdateFiles(), free=getFreeBytes(settings().getBaseFolder("updates")))
def readGcodeFiles(): files = _getFileList(FileDestinations.LOCAL) files.extend(_getFileList(FileDestinations.SDCARD)) return jsonify(files=files, free=util.getFreeBytes(settings().getBaseFolder("uploads")))
def readGcodeFiles(): files = _getFileList(FileDestinations.LOCAL) files.extend(_getFileList(FileDestinations.SDCARD)) #modify by kevin, for different path return jsonify(files=files, free=util.getFreeBytes(gcodeManager._uploadFolder))
def readGcodeFilesForTarget(target): if target not in [FileDestinations.LOCAL, FileDestinations.SDCARD]: return make_response("Invalid target: %s" % target, 400) return jsonify(files=_getFileList(target), free=util.getFormattedSize(util.getFreeBytes(settings().getBaseFolder("uploads"))))