mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	put code under CONSUMER_ENABLE_BARCODES
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
		| @@ -185,38 +185,38 @@ def consume_file( | |||||||
| ): | ): | ||||||
|  |  | ||||||
|     # check for separators in current document |     # check for separators in current document | ||||||
|     separators = [] |  | ||||||
|     if settings.CONSUMER_ENABLE_BARCODES: |     if settings.CONSUMER_ENABLE_BARCODES: | ||||||
|  |         separators = [] | ||||||
|  |         document_list = [] | ||||||
|         separators = scan_file_for_separating_barcodes(path) |         separators = scan_file_for_separating_barcodes(path) | ||||||
|     document_list = [] |         if separators: | ||||||
|     if separators: |             logger.debug(f"Pages with separators found in: {str(path)}") | ||||||
|         logger.debug(f"Pages with separators found in: {str(path)}") |             document_list = separate_pages(path, separators) | ||||||
|         document_list = separate_pages(path, separators) |         if document_list: | ||||||
|     if document_list: |             for n, document in enumerate(document_list): | ||||||
|         for n, document in enumerate(document_list): |                 # save to consumption dir | ||||||
|             # save to consumption dir |                 # rename it to the original filename  with number prefix | ||||||
|             # rename it to the original filename  with number prefix |                 newname = f"{str(n)}_" + override_filename | ||||||
|             newname = f"{str(n)}_" + override_filename |                 save_to_dir(document, newname=newname) | ||||||
|             save_to_dir(document, newname=newname) |             # if we got here, the document was successfully split | ||||||
|         # if we got here, the document was successfully split |             # and can safely be deleted | ||||||
|         # and can safely be deleted |             logger.debug("Deleting file {}".format(path)) | ||||||
|         logger.debug("Deleting file {}".format(path)) |             os.unlink(path) | ||||||
|         os.unlink(path) |             # notify the sender, otherwise the progress bar | ||||||
|         # notify the sender, otherwise the progress bar |             # in the UI stays stuck | ||||||
|         # in the UI stays stuck |             payload = { | ||||||
|         payload = { |                 "filename": override_filename, | ||||||
|             "filename": override_filename, |                 "task_id": task_id, | ||||||
|             "task_id": task_id, |                 "current_progress": 100, | ||||||
|             "current_progress": 100, |                 "max_progress": 100, | ||||||
|             "max_progress": 100, |                 "status": "SUCCESS", | ||||||
|             "status": "SUCCESS", |                 "message": "finished", | ||||||
|             "message": "finished", |             } | ||||||
|         } |             async_to_sync(get_channel_layer().group_send)( | ||||||
|         async_to_sync(get_channel_layer().group_send)( |                 "status_updates", | ||||||
|             "status_updates", |                 {"type": "status_update", "data": payload}, | ||||||
|             {"type": "status_update", "data": payload}, |             ) | ||||||
|         ) |             return "File successfully split" | ||||||
|         return "File successfully split" |  | ||||||
|  |  | ||||||
|     # continue with consumption if no barcode was found |     # continue with consumption if no barcode was found | ||||||
|     document = Consumer().try_consume_file( |     document = Consumer().try_consume_file( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Florian Brandes
					Florian Brandes