A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
progress bar for the document importer
jonaswinklerebcb2cf694a0
diff --git a/src/documents/management/commands/document_importer.py b/src/documents/management/commands/document_importer.pyindex 8e9a79219..344be32be 100644--- a/src/documents/management/commands/document_importer.py+++ b/src/documents/management/commands/document_importer.py@@ -1,8 +1,10 @@import json+import loggingimport osimport shutilfrom contextlib import contextmanager+import tqdmfrom django.conf import settingsfrom django.core.management import call_commandfrom django.core.management.base import BaseCommand, CommandError@@ -43,6 +45,8 @@ class Command(Renderable, BaseCommand):def handle(self, *args, **options):+ logging.getLogger().handlers[0].level = logging.ERROR+self.source = options["source"]if not os.path.exists(self.source):@@ -111,10 +115,13 @@ class Command(Renderable, BaseCommand):os.makedirs(settings.THUMBNAIL_DIR, exist_ok=True)os.makedirs(settings.ARCHIVE_DIR, exist_ok=True)- for record in self.manifest:+ print("Copy files into paperless...")- if not record["model"] == "documents.document":- continue+ manifest_documents = list(filter(+ lambda r: r["model"] == "documents.document",+ self.manifest))++ for record in tqdm.tqdm(manifest_documents):document = Document.objects.get(pk=record["pk"])@@ -138,7 +145,6 @@ class Command(Renderable, BaseCommand):create_source_path_directory(document.source_path)- print(f"Moving {document_path} to {document.source_path}")shutil.copy(document_path, document.source_path)shutil.copy(thumbnail_path, document.thumbnail_path)if archive_path: