attempt to use separate folder for docs and meetings

This commit is contained in:
Mariano Gabriel
2026-07-06 01:18:17 -03:00
parent bb84558526
commit 31ad8e5928
10 changed files with 261 additions and 62 deletions

View File

@@ -45,7 +45,9 @@ def classify(ext: str) -> str:
return "link"
def build_index(source_root, output_dir, options=None, dry_run=False) -> dict:
def build_index(source_root, output_dir, options=None, dry_run=False, only="all") -> dict:
"""Index a source tree. `only` scopes the collection so outputs stay separate:
'all' (default), 'docs' (skip meetings — no bloat), 'meetings' (only videos)."""
options = options or {}
root = Path(source_root).resolve()
if not root.is_dir():
@@ -63,6 +65,9 @@ def build_index(source_root, output_dir, options=None, dry_run=False) -> dict:
rel = p.relative_to(root).as_posix()
ext = p.suffix.lower().lstrip(".")
mode = classify(ext)
# Scope the collection: docs exclude meetings; meetings exclude the rest.
if (only == "docs" and mode == "meeting") or (only == "meetings" and mode != "meeting"):
continue
counts[mode] += 1
stat = p.stat()
birth = getattr(stat, "st_birthtime", None) # not on every filesystem
@@ -90,6 +95,7 @@ def build_index(source_root, output_dir, options=None, dry_run=False) -> dict:
index = {
"root": str(root),
"only": only,
"generatedAt": datetime.now().isoformat(),
"counts": {**counts, "total": len(files)},
"files": files,