diff --git a/README.md b/README.md index 4698f0d..7033c4f 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,18 @@ offline on your machine. | `vision/` | Motion detection, document contours, perspective crop, sharpness | Built | | `events/` | State machine: placed / page-flipped / cleared, pod grouping | Planned | | `transcribe/` | Local speech-to-text (faster-whisper) | Planned | -| `ocr/` | OCR fallback naming (Tesseract) | Planned | -| `naming/` | Final filename assembly + summary CSV | Planned | -| `pdf/` | PDF assembly + Paperless-ngx consume staging | Planned | +| `ocr/` | OCR fallback naming (Tesseract): vendor, date, total | Built | +| `naming/` | Final filename assembly + summary CSV | Built | +| `pdf/` | PDF assembly (img2pdf) | Built — single-page only, no consume-folder staging | | `review_cli/` | Pre-export review (rename/merge/split) | Planned | +**Known limitation:** there is no page-flip / multi-page grouping yet +(that's `events/`). Every detected document currently becomes its own +single-page PDF, even if it was physically one page of a stack or one side +of a double-sided document. Don't point `export` at the Paperless-ngx +consume folder for multi-page documents until `events/` exists — you'll get +one PDF per page instead of one PDF per document. + ## Setup Requires Python 3.11+ and ffmpeg (`brew install ffmpeg`). @@ -51,6 +58,9 @@ python -m paperpod probe sample_data/videos/synthetic_sample.mp4 # Detect stable windows + document candidates python -m paperpod detect sample_data/videos/synthetic_sample.mp4 +# Detect, OCR-name, and export each document as its own PDF +python -m paperpod export sample_data/videos/receipts_sample.mp4 + # Extract the audio track (16 kHz mono WAV, whisper-ready) python -m paperpod extract-audio my_recording.mp4 ``` @@ -62,6 +72,17 @@ python -m paperpod extract-audio my_recording.mp4 - `report.json` — video metadata, motion events, stable windows, detections - `motion_scores.csv` — per-sample motion scores, for tuning `motion.threshold` +`export` runs `detect` and then, for every detected document, additionally writes: + +- `pdf/.pdf` — one single-page PDF per detected document, named + `YYYY-MM-DD_vendor.pdf` from OCR-extracted date/vendor, or + `UNSORTED_.pdf` if OCR couldn't find anything usable +- `export_summary.csv` — timestamp, pod_id, page_count, source_of_name + (`ocr`/`none`), OCR vendor/date/total/confidence, final filename + +Nothing is copied into a Paperless-ngx consume directory yet — review the +`pdf/` folder yourself before moving files anywhere. + ## Tuning All thresholds live in `config.yaml` (motion sensitivity, stable window diff --git a/paperpod/cli.py b/paperpod/cli.py index d0045fc..af39df8 100644 --- a/paperpod/cli.py +++ b/paperpod/cli.py @@ -3,6 +3,7 @@ Usage: python -m paperpod probe