예제 #1
0
파일: __init__.py 프로젝트: xmodpt/mariner
 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())
예제 #2
0
 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())
예제 #3
0
 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())
예제 #4
0
파일: api.py 프로젝트: PowerWiesel/mariner
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