From 2be0d6a650695a6ab59b0774b25a07a3cd766d01 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Apr 2025 13:52:34 +0530 Subject: [PATCH] ... --- src/calibre/srv/render_book.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/render_book.py b/src/calibre/srv/render_book.py index d592a26773..d4b15596e9 100644 --- a/src/calibre/srv/render_book.py +++ b/src/calibre/srv/render_book.py @@ -845,6 +845,8 @@ def viewer_main(): render_for_viewer(*args) +# QuickLook {{{ + def quicklook(pathtoebook: str, output_dir: str) -> dict[str, object]: pathtoebook = os.path.abspath(pathtoebook) output_dir = os.path.abspath(output_dir) @@ -880,10 +882,10 @@ def handle_quicklook_client(c) -> None: return req = json.loads(line) try: - output = {'ok': True, 'result': quicklook(req['path'], req['output_dir'])} + output = {'ok': True, 'path': req['path'], 'result': quicklook(req['path'], req['output_dir'])} except Exception as e: import traceback - output = {'ok': False, 'error': str(e), 'traceback': traceback.format_exc()} + output = {'ok': False, 'path': req['path'], 'error': str(e), 'traceback': traceback.format_exc()} with c.makefile('w', encoding='utf-8') as outf: json.dump(output, outf) print(file=outf, flush=True) @@ -938,6 +940,8 @@ def quicklook_service(path_to_socket: str) -> None: c.shutdown(socket.SHUT_RDWR) c.close() +# }}} + class Profiler: