if [[ (! -f "$index_version_file") || $(<$index_version_file) != "$index_version" ]]; then
echo "Search index out of date. Updating..."
- python3 manage.py document_index reindex
+ python3 manage.py document_index reindex --no-progress-bar
echo $index_version | tee $index_version_file >/dev/null
fi
}
"""Walk up the directory tree from filepath to CONSUMPTION_DIR
and 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.parts
for part in path_parts:
tag_ids.add(
Tag.objects.get_or_create(name__iexact=part, defaults={"name": part})[0].pk,
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)
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")