def run(self) -> None: os.nice(5) for file in chain(FILES_DIRECTORY.rglob("*.ctb"), FILES_DIRECTORY.rglob("*.cbddlp")): read_cached_ctb_file(file.absolute()) for file in chain(FILES_DIRECTORY.rglob("*.ctb"), FILES_DIRECTORY.rglob("*.cbddlp")): read_cached_preview(file.absolute())
def run(self) -> None: os.nice(5) globs = [ FILES_DIRECTORY.rglob(f"*{extension}") for extension in get_supported_extensions() ] for file in chain.from_iterable(globs): read_cached_sliced_model_file(file.absolute()) read_cached_preview(file.absolute())
def run(self) -> None: os.nice(5) globs = [ config.get_files_directory().rglob(f"*{extension}") for extension in get_supported_extensions() ] for file in chain.from_iterable(globs): read_cached_sliced_model_file(file.absolute()) read_cached_preview(file.absolute())
def file_preview() -> Response: filename = str(request.args.get("filename")) path = (config.get_files_directory() / filename).resolve() if config.get_files_directory() not in path.parents: abort(400) preview_bytes = read_cached_preview(path) response = make_response(preview_bytes) response.headers.set("Content-Type", "image/png") response.headers.set( "Content-Disposition", "attachment", filename=f"{filename}.png" ) return response