doocus improvemnts

This commit is contained in:
Mariano Gabriel
2026-07-05 20:35:44 -03:00
parent 7b276e8f3d
commit 8606520ef2
22 changed files with 1328 additions and 61 deletions

View File

@@ -9,6 +9,13 @@
# make batch IN="..." EXT="mp4 mov" # limit extensions
# make batch IN="..." FLAGS="--embed-images" # replace the base flags
#
# Meetings flow (process only the videos doocus found, coherent with the docs):
# 1. uv run make docs IN="/mnt/drive" # → docs-output/{index.json, meetings.txt}
# 2. make batch IN="/mnt/drive" OUT=docs-output \ # meetus over just the meetings…
# LIST=docs-output/meetings.txt \ # …only the listed relative paths
# OUT_FORMAT="{name}.meetus" # …into <file>.meetus/ sidecars
# (matches doocus's index pointer, so meetings sit beside the <file>.doocus/ docs.)
#
# IN is required. OUT defaults to IN (write in place); otherwise the input
# folder structure is mirrored under OUT.
@@ -38,6 +45,11 @@ export PYTHON
# make batch IN="/mnt/drive" OUT=docs-output LIST=docs-output/meetings.txt
LIST ?=
# Optional: run-folder name template forwarded to process_meeting.py --out-format.
# Tokens: {date} {run} {stem} {name}. Default (empty) → "{date}-{run:03d}-{stem}".
# Use "{name}.meetus" so meetings land in a docs-coherent <file>.meetus/ sidecar.
OUT_FORMAT ?=
# doocus (tree indexing) knobs. DOCS_OUT defaults to docs-output; the whole input
# tree is replicated into index.json under it. DOC_EXTRA forwards one-off flags to
# process_tree.py (e.g. --render for pdf page thumbnails, --ocr for scanned pdfs).
@@ -47,14 +59,23 @@ DOC_EXTRA ?=
# Python interpreter for doocus (override PYTHON, else python3 — use `uv run make`).
PY := $(if $(PYTHON),$(PYTHON),python3)
.PHONY: batch dry docs docs-dry help
# Merge a separate output tree into another (e.g. a meetings run done in its own
# folder → docs-output). Both mirror the same source-relative structure, so this
# just unions the sidecars beside the docs. Always dry-run first.
# make merge-dry SRC=meetings-output # preview
# make merge SRC=meetings-output # apply (DST defaults to docs-output)
MERGE_SRC ?=
MERGE_DST ?= docs-output
.PHONY: batch dry docs docs-dry merge merge-dry help
batch:
@ctrl/batch.sh -i "$(IN)" -o "$(OUT)" $(if $(EXT),-e "$(EXT)") $(if $(LIST),-l "$(LIST)") -- \
$(FLAGS) $(if $(AUDIO_LANG),--language $(AUDIO_LANG)) $(EXTRA)
$(FLAGS) $(if $(AUDIO_LANG),--language $(AUDIO_LANG)) \
$(if $(OUT_FORMAT),--out-format "$(OUT_FORMAT)") $(EXTRA)
dry:
@ctrl/batch.sh -i "$(IN)" -o "$(OUT)" $(if $(EXT),-e "$(EXT)") -n
@ctrl/batch.sh -i "$(IN)" -o "$(OUT)" $(if $(EXT),-e "$(EXT)") $(if $(LIST),-l "$(LIST)") -n
# Document indexing (doocus): replicate the whole IN tree into DOCS_OUT/index.json,
# extracting text sidecars only for docx/pdf/pptx/xlsx.
@@ -67,5 +88,17 @@ docs:
docs-dry:
@$(PY) process_tree.py "$(IN)" --output "$(DOCS_OUT)" --dry-run
# index.json/meetings.txt are excluded so a merge of meeting dumps can never
# clobber the canonical index that lives only in docs-output.
MERGE_EXCLUDES = --exclude index.json --exclude meetings.txt
merge:
@test -n "$(MERGE_SRC)" || { echo "ERROR: MERGE_SRC is required" >&2; exit 1; }
@rsync -a $(MERGE_EXCLUDES) "$(MERGE_SRC)/" "$(MERGE_DST)/" && echo "merged $(MERGE_SRC)$(MERGE_DST)"
merge-dry:
@test -n "$(MERGE_SRC)" || { echo "ERROR: MERGE_SRC is required" >&2; exit 1; }
@rsync -avn $(MERGE_EXCLUDES) "$(MERGE_SRC)/" "$(MERGE_DST)/"
help:
@sed -n '3,14p' Makefile