A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Minor improvements for quality of life
Trenton Holmes7cbb73be7af5
diff --git a/docker/docker-prepare.sh b/docker/docker-prepare.shindex 477233784..1756d88c4 100755--- a/docker/docker-prepare.sh+++ b/docker/docker-prepare.sh@@ -52,7 +52,7 @@ search_index() {if [[ (! -f "$index_version_file") || $(<$index_version_file) != "$index_version" ]]; thenecho "Search index out of date. Updating..."- python3 manage.py document_index reindex+ python3 manage.py document_index reindex --no-progress-barecho $index_version | tee $index_version_file >/dev/nullfi}diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.pyindex eb6f0a405..87e3af2c3 100644--- a/src/documents/management/commands/document_consumer.py+++ b/src/documents/management/commands/document_consumer.py@@ -28,8 +28,11 @@ def _tags_from_path(filepath):"""Walk up the directory tree from filepath to CONSUMPTION_DIRand get or create Tag IDs for every directory."""+ normalized_consumption_dir = os.path.abspath(+ os.path.normpath(settings.CONSUMPTION_DIR),+ )tag_ids = set()- path_parts = Path(filepath).relative_to(settings.CONSUMPTION_DIR).parent.parts+ path_parts = Path(filepath).relative_to(normalized_consumption_dir).parent.partsfor part in path_parts:tag_ids.add(Tag.objects.get_or_create(name__iexact=part, defaults={"name": part})[0].pk,@@ -39,7 +42,10 @@ def _tags_from_path(filepath):def _is_ignored(filepath: str) -> bool:- filepath_relative = PurePath(filepath).relative_to(settings.CONSUMPTION_DIR)+ normalized_consumption_dir = os.path.abspath(+ os.path.normpath(settings.CONSUMPTION_DIR),+ )+ filepath_relative = PurePath(filepath).relative_to(normalized_consumption_dir)return any(filepath_relative.match(p) for p in settings.CONSUMER_IGNORE_PATTERNS)@@ -160,6 +166,8 @@ class Command(BaseCommand):if not directory:raise CommandError("CONSUMPTION_DIR does not appear to be set.")+ directory = os.path.abspath(directory)+if not os.path.isdir(directory):raise CommandError(f"Consumption directory {directory} does not exist")