This commit is contained in:
2026-04-21 17:54:52 +02:00
parent b749817304
commit 638dc0dd2f
2 changed files with 32 additions and 4 deletions
+15 -1
View File
@@ -11,6 +11,7 @@ from indexer.db import (
)
from indexer.events import batch_log_events
from indexer.backup import ensure_backed_up
from indexer.hasher import is_cloud_placeholder
def main():
@@ -72,15 +73,22 @@ def main():
files_to_backup = []
# 5a) NEW files — compute BLAKE3, batch INSERT
skipped_files = []
if new_paths:
print(f" Hashing {len(new_paths)} new files...")
new_files = []
for p in new_paths:
f = fs[p]
if is_cloud_placeholder(f["full_path"]):
reason = "not synced (cloud placeholder)"
print(f" WARN: skip {p}: {reason}")
skipped_files.append((p, reason))
continue
try:
content_hash = blake3_file(f["full_path"])
except (FileNotFoundError, PermissionError, OSError) as e:
print(f" WARN: skip {p}: {e}")
skipped_files.append((p, str(e)))
continue
new_files.append({
"relative_path": p,
@@ -168,7 +176,7 @@ def main():
# ── 7. Finalize ──
stats = {
"total": len(fs),
"new": len(new_paths),
"new": len(new_files) if new_paths else 0,
"modified": len(modified_paths),
"deleted": len(deleted_paths),
"unchanged": len(unchanged_paths),
@@ -196,6 +204,12 @@ def main():
print(f"Modified : {stats['modified']}")
print(f"Deleted : {stats['deleted']}")
print(f"Unchanged: {stats['unchanged']}")
if skipped_files:
print(f"Skipped : {len(skipped_files)} (hash failed)")
print("-" * 60)
for path, reason in skipped_files:
print(f" SKIP: {path}")
print(f" {reason}")
print("=" * 60)
# ── 8. Generate Excel report ──