From b77e2a3b0ed2bf8aaa3de0c7e4c2a21a1eb26a7a Mon Sep 17 00:00:00 2001 From: Daniel Neuwirth <daniel.neuwirth@dataport.de> Date: Mon, 9 Dec 2019 17:24:35 +0000 Subject: [PATCH] without background --- ckanext/odsh/pdf_to_thumbnail/enqueue.py | 8 ++++---- ckanext/odsh/pdf_to_thumbnail/thumbnail.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ckanext/odsh/pdf_to_thumbnail/enqueue.py b/ckanext/odsh/pdf_to_thumbnail/enqueue.py index 79dac509..c7840794 100644 --- a/ckanext/odsh/pdf_to_thumbnail/enqueue.py +++ b/ckanext/odsh/pdf_to_thumbnail/enqueue.py @@ -59,12 +59,12 @@ def enqueue_after_create(context, resource): private = package.private # without the background job - #create_thumbnail(resource, private) + create_thumbnail(resource, private) #background job - args = (config['__file__'], resource, private) - title = 'Thumbnail creating for resource {}'.format(resource['id']) - toolkit.enqueue_job(job_after_create, args=args, title=title) + #args = (config['__file__'], resource, private) + #title = 'Thumbnail creating for resource {}'.format(resource['id']) + #toolkit.enqueue_job(job_after_create, args=args, title=title) diff --git a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py index 9cf35691..d5343017 100644 --- a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py +++ b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py @@ -55,8 +55,7 @@ def change_filepath(package_id, old_private, new_private): def create_thumbnail_from_file(file, package_id, private): - log.debug("create_thumbnail_from_file") - log.warning("create_thumbnail_from_file") + log.debug('create_thumbnail_from_file') width = config.get('ckan.thumbnail.size.width', 410) filename = hash_filename(package_id, private) file.seek(0) @@ -71,7 +70,6 @@ def create_thumbnail_from_file(file, package_id, private): #size=(width, None), output_folder=directory, output_file=filename, - single_file=True, first_page=0, last_page=0, fmt='jpg' @@ -80,6 +78,7 @@ def create_thumbnail_from_file(file, package_id, private): def create_thumbnail_from_memory(resource, private): + log.debug('create_thumbnail_from_memory') path = get_filepath_to_resource(resource) file_type = magic.from_file(path, mime = True) if file_type == 'application/pdf' and os.path.exists(path): @@ -99,6 +98,7 @@ def remove_thumbnail(package_id, private): os.remove(filepath) def create_thumbnail(resource, private): + log.debug('create_thumbnail') resource_path = get_filepath_to_resource(resource) if os.path.exists(resource_path): return create_thumbnail_from_memory(resource, private) -- GitLab