A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Add thumbnail export
CkuT2e0e6bb8d2a0
diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.pyindex 1c6ac6e44..8203f930e 100644--- a/src/documents/management/commands/document_exporter.py+++ b/src/documents/management/commands/document_exporter.py@@ -62,7 +62,9 @@ class Command(Renderable, BaseCommand):document = document_map[document_dict["pk"]]target = os.path.join(self.target, document.file_name)+ thumbnail_target = target + "-tumbnail.png"document_dict["__exported_file_name__"] = target+ document_dict["__exported_thumbnail_name__"] = thumbnail_targetprint("Exporting: {}".format(target))@@ -71,6 +73,11 @@ class Command(Renderable, BaseCommand):t = int(time.mktime(document.created.timetuple()))os.utime(target, times=(t, t))+ with open(thumbnail_target, "wb") as f:+ f.write(GnuPG.decrypted(document.thumbnail_file))+ t = int(time.mktime(document.created.timetuple()))+ os.utime(target, times=(t, t))+manifest += json.loads(serializers.serialize("json", Correspondent.objects.all()))diff --git a/src/documents/management/commands/document_importer.py b/src/documents/management/commands/document_importer.pyindex afa0164ab..be6fbc8bd 100644--- a/src/documents/management/commands/document_importer.py+++ b/src/documents/management/commands/document_importer.py@@ -91,9 +91,15 @@ class Command(Renderable, BaseCommand):continuedoc_file = record["__exported_file_name__"]+ thumb_file = record["__exported_thumbnail_name__"]document = Document.objects.get(pk=record["pk"])with open(doc_file, "rb") as unencrypted:with open(document.source_path, "wb") as encrypted:print("Encrypting {} and saving it to {}".format(doc_file, document.source_path))encrypted.write(GnuPG.encrypted(unencrypted))+ with open(thumb_file, "rb") as unencrypted:+ with open(document.thumbnail_path, "wb") as encrypted:+ print("Encrypting {} and saving it to {}".format(+ thumb_file, document.thumbnail_path))+ encrypted.write(GnuPG.encrypted(unencrypted))