diff --git a/ckanext/odsh/pdf_to_thumbnail/enqueue.py b/ckanext/odsh/pdf_to_thumbnail/enqueue.py index 79dac5091112b3160d9c69cc19f5b36f28c46442..c7840794b6c37fade613e215c4a52dfc22e0b247 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 9cf3569169235a2dec063485024d7c19c77ce084..d53430174d1fa7487c71e229e4d8fea48c82f73e 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)