Fix PDF generation for non-vanishing collection path
This commit is contained in:
parent
62bb338898
commit
1ee58510df
1 changed files with 4 additions and 3 deletions
|
@ -110,7 +110,7 @@ def get_settings():
|
||||||
settings_path = config_dir / 'settings.json'
|
settings_path = config_dir / 'settings.json'
|
||||||
try:
|
try:
|
||||||
with open(settings_path, 'r') as file:
|
with open(settings_path, 'r') as file:
|
||||||
setting_cache = json.loads(file.read())
|
settings_cache = json.loads(file.read())
|
||||||
return deepcopy(settings_cache or {})
|
return deepcopy(settings_cache or {})
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.exception(err)
|
logger.exception(err)
|
||||||
|
@ -216,7 +216,7 @@ def get_params(settings=None):
|
||||||
device_settings = settings.get('device_settings', {}).get(device_id, {})
|
device_settings = settings.get('device_settings', {}).get(device_id, {})
|
||||||
collection_choices = [str(d.relative_to(archive_dir))
|
collection_choices = [str(d.relative_to(archive_dir))
|
||||||
for d in archive_dir.glob('**') if d.is_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 {
|
return {
|
||||||
'devices': settings.get('devices', []),
|
'devices': settings.get('devices', []),
|
||||||
'device_id': device_id,
|
'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():
|
for p in cache_dir_pdf.iterdir():
|
||||||
p.unlink()
|
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:
|
if lossy:
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
Loading…
Reference in a new issue