From 1ee58510df66d9cb1894f25e9ae37589c1a419b5 Mon Sep 17 00:00:00 2001 From: iburadempa Date: Fri, 6 Dec 2024 04:55:27 +0100 Subject: [PATCH] Fix PDF generation for non-vanishing collection path --- server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index d31f4c9..ac99529 100755 --- a/server.py +++ b/server.py @@ -110,7 +110,7 @@ def get_settings(): settings_path = config_dir / 'settings.json' try: with open(settings_path, 'r') as file: - setting_cache = json.loads(file.read()) + settings_cache = json.loads(file.read()) return deepcopy(settings_cache or {}) except Exception as err: logger.exception(err) @@ -216,7 +216,7 @@ def get_params(settings=None): device_settings = settings.get('device_settings', {}).get(device_id, {}) collection_choices = [str(d.relative_to(archive_dir)) for d in archive_dir.glob('**') if d.is_dir()] - collection_choices.sort(key=lambda x: x.lower()) + collection_choices.sort(key=lambda x: x.lower()) return { 'devices': settings.get('devices', []), 'device_id': device_id, @@ -569,7 +569,8 @@ async def create_pdf(pages, lossy: bool = False, ocr: bool = False): for p in cache_dir_pdf.iterdir(): p.unlink() - img_paths = [str(archive_dir / f'{page}.png') for page in pages] + collection_choice = Path(get_settings().get('collection_choice', '.')) + img_paths = [str(archive_dir / collection_choice / f'{page}.png') for page in pages] if lossy: cmd = [