How phuc-nt/scan-to-ebook works
scan-to-ebook turns scans, PDFs, and Drive sources into either OCR-based prose EPUBs or offline manga EPUB3s. The prose workflow prepares pages, gathers book context, OCRs pages, merges and cleans Markdown, then builds an EPUB; users can also verify outputs and track OCR costs. Manga follows a separate image-import-to-fixed-layout workflow. The graph reflects README capabilities and sampled orchestration; some links for documented but unsampled features are omitted where call ownership is unclear.
Main entry points: cli.py CLI commands · pipeline.py Prose coordinator · manga_pipeline.py Manga coordinator · drive_input.py Drive input
Components 21
CLI and orchestration
- CLI commands
src/scan_to_ebook/cli.py - Prose coordinator
src/scan_to_ebook/pipeline.py - Manga coordinator
src/scan_to_ebook/manga_pipeline.py
Input preparation
- Drive input
src/scan_to_ebook/drive_input.py - Drive downloader
src/scan_to_ebook/drive_download.py - PDF renderer
src/scan_to_ebook/pdf_render.py - Image preparation
src/scan_to_ebook/image_ops.py - Archive extraction
src/scan_to_ebook/archive_extract.py - MOBI extraction
src/scan_to_ebook/mobi_extract.py
Prose OCR workflow
- Book context prepass
src/scan_to_ebook/context_prepass.py - Page OCR
src/scan_to_ebook/ocr.py - Text post-processing
src/scan_to_ebook/post_process.py - Prose EPUB builder
src/scan_to_ebook/epub_build.py - EPUB verification
src/scan_to_ebook/epub_verify.py
Manga workflow
- Fixed-layout builder
src/scan_to_ebook/epub3_fixed_layout.py - Manga cover detection
src/scan_to_ebook/manga_cover_detect.py
State and integrations
- Cost ledger
src/scan_to_ebook/cost_ledger.py - OpenRouter vision API
- pandoc
- Google Drive
Other components
- Book creator
Connections 22
- Book creator → CLI commands: runs commands
- CLI commands → Prose coordinator: dispatches prose
- CLI commands → Manga coordinator: dispatches manga
- Prose coordinator → Book context prepass: runs prepass
- Prose coordinator → Page OCR: runs OCR
- Prose coordinator → Text post-processing: processes text
- Prose coordinator → Prose EPUB builder: builds EPUB
- Prose coordinator → Cost ledger: records costs
- CLI commands → EPUB verification: verifies EPUB
- Book context prepass → OpenRouter vision API: requests context
- Page OCR → OpenRouter vision API: requests OCR
- Prose EPUB builder → pandoc: converts Markdown
- CLI commands → PDF renderer: renders PDF
- CLI commands → Image preparation: imports images
- Manga coordinator → Drive input: imports Drive
- Drive input → Drive downloader: downloads files
- Drive downloader → Google Drive: fetches source
- Manga coordinator → Archive extraction: extracts archives
- Manga coordinator → MOBI extraction: extracts MOBI
- Manga coordinator → Fixed-layout builder: builds EPUB3
- Manga coordinator → Manga cover detection: detects cover
- Manga cover detection → OpenRouter vision API: requests detection