# fernandodev0/biblioteca_audio_play architecture

> Architecture diagram of the GitHub repository fernandodev0/biblioteca_audio_play, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fernandodev0/biblioteca_audio_play
- Repository: https://github.com/fernandodev0/biblioteca_audio_play

## Overview

Biblioteca is a desktop PDF-to-audiobook reader. A person imports a PDF in Estúdio; the app extracts and classifies page content, stores the document and reading metadata, then generates Opus clips with word timings for eligible text. Acervo lists processed books, and Leitura presents two pages while playing and highlighting speech. The README also documents search, resumable batches, OCR for image-only pages, and persisted reading position. Edges follow shown imports/calls or README-described behavior; some integration details are documented but not visible in sampled code.

Main entry points: [`app/ui/leitura.py`](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/leitura.py) (Two-page reader), [`app/pipeline.py`](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/pipeline.py) (Import and batch pipeline), [`app/ui/shell.py`](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/shell.py) (Screen navigation), [`app/tts.py`](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/tts.py) (Speech synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_app_entry["Application setup<br/>[main.py]"]
  node_shell["Screen navigation<br/>[shell.py]"]
  node_studio["PDF import<br/>[estudio.py]"]
  node_catalog["Book catalog<br/>[acervo.py]"]
  node_reader["Two-page reader<br/>[leitura.py]"]
  node_text_view["Text and code view<br/>[texto.py]"]
  node_syntax["Syntax highlighting<br/>[sintaxe.py]"]
end

subgraph group_processing["Document processing"]
  node_extract["PDF extraction<br/>[extract.py]"]
  node_classify["Block classification<br/>[classify.py]"]
  node_batch["Import and batch pipeline<br/>[pipeline.py]"]
  node_machine["On-demand capacity<br/>[machine.py]"]
end

subgraph group_speech["Audio generation"]
  node_voice["Speech synthesis<br/>[tts.py]"]
  node_opus["Opus conversion<br/>[opus.py]"]
  node_alignment["Word timing<br/>[align.py]"]
  node_playback["Audio playback<br/>[player.py]"]
end

subgraph group_library["Library data"]
  node_db[("Library index<br/>[db.py]")]
  node_paths["Data locations<br/>[paths.py]"]
  node_library_files["PDF text audio"]
end

node_person(("Reader"))
node_edge_tts{{"Francisca neural voice"}}
node_tesseract{{"Tesseract OCR"}}
node_vlc{{"VLC"}}

node_person -->|"opens"| node_app_entry
node_app_entry -->|"shows"| node_shell
node_shell -->|"routes to"| node_studio
node_shell -->|"routes to"| node_catalog
node_shell -->|"opens book"| node_reader
node_studio -->|"starts import"| node_batch
node_batch -->|"extracts pages"| node_extract
node_extract -->|"classifies blocks"| node_classify
node_batch -->|"records progress"| node_db
node_batch -->|"generates clips"| node_voice
node_extract -.->|"transcribes photos"| node_tesseract
node_voice -->|"requests speech"| node_edge_tts
node_voice -->|"converts audio"| node_opus
node_voice -->|"aligns fallback"| node_alignment
node_batch -->|"writes artifacts"| node_library_files
node_paths -->|"locates files"| node_library_files
node_db -->|"indexes artifacts"| node_library_files
node_catalog -->|"lists books"| node_db
node_reader -->|"loads reading data"| node_db
node_reader -->|"requests missing audio"| node_batch
node_reader -->|"plays clips"| node_playback
node_reader -->|"checks capacity"| node_machine
node_reader -->|"renders page text"| node_text_view
node_text_view -->|"highlights code"| node_syntax
node_playback -.->|"plays through"| node_vlc

click node_app_entry "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/main.py"
click node_shell "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/shell.py"
click node_studio "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/estudio.py"
click node_catalog "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/acervo.py"
click node_reader "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/leitura.py"
click node_text_view "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/texto.py"
click node_syntax "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/sintaxe.py"
click node_extract "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/extract.py"
click node_classify "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/classify.py"
click node_batch "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/pipeline.py"
click node_machine "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/machine.py"
click node_voice "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/tts.py"
click node_opus "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/opus.py"
click node_alignment "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/align.py"
click node_playback "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/player.py"
click node_db "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/db.py"
click node_paths "https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/paths.py"
click node_library_files "https://github.com/fernandodev0/biblioteca_audio_play/tree/main/biblioteca"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_entry,node_shell,node_studio,node_catalog,node_reader,node_text_view,node_syntax toneBlue
class node_extract,node_classify,node_batch,node_machine toneAmber
class node_voice,node_opus,node_alignment,node_playback toneMint
class node_db,node_paths,node_library_files toneRose
class node_person,node_edge_tts,node_tesseract,node_vlc toneIndigo
```

## Components

### Desktop interface

- [Application setup](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/main.py): `app/main.py`
- [Screen navigation](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/shell.py): `app/ui/shell.py`
- [PDF import](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/estudio.py): `app/ui/estudio.py`
- [Book catalog](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/acervo.py): `app/ui/acervo.py`
- [Two-page reader](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/leitura.py): `app/ui/leitura.py`
- [Text and code view](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/texto.py): `app/ui/texto.py`
- [Syntax highlighting](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/ui/sintaxe.py): `app/ui/sintaxe.py`

### Document processing

- [PDF extraction](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/extract.py): `app/extract.py`
- [Block classification](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/classify.py): `app/classify.py`
- [Import and batch pipeline](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/pipeline.py): `app/pipeline.py`
- [On-demand capacity](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/machine.py): `app/machine.py`

### Audio generation

- [Speech synthesis](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/tts.py): `app/tts.py`
- [Opus conversion](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/opus.py): `app/opus.py`
- [Word timing](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/align.py): `app/align.py`
- [Audio playback](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/player.py): `app/player.py`

### Library data

- [Library index](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/db.py): `app/db.py`
- [Data locations](https://github.com/fernandodev0/biblioteca_audio_play/blob/main/app/paths.py): `app/paths.py`
- [PDF text audio](https://github.com/fernandodev0/biblioteca_audio_play/tree/main/biblioteca): `biblioteca`

### Other components

- **Reader**
- **Francisca neural voice**
- **Tesseract OCR**
- **VLC**

## Connections

- Reader → Application setup: opens (evidence: `README.md`)
- Application setup → Screen navigation: shows (evidence: `app/main.py`)
- Screen navigation → PDF import: routes to (evidence: `app/ui/shell.py`)
- Screen navigation → Book catalog: routes to (evidence: `app/ui/shell.py`)
- Screen navigation → Two-page reader: opens book (evidence: `app/ui/shell.py`)
- PDF import → Import and batch pipeline: starts import (evidence: `app/ui/estudio.py`)
- Import and batch pipeline → PDF extraction: extracts pages (evidence: `app/pipeline.py`)
- PDF extraction → Block classification: classifies blocks (evidence: `app/extract.py`)
- Import and batch pipeline → Library index: records progress (evidence: `app/pipeline.py`)
- Import and batch pipeline → Speech synthesis: generates clips (evidence: `app/pipeline.py`)
- PDF extraction → Tesseract OCR: transcribes photos (evidence: `README.md`)
- Speech synthesis → Francisca neural voice: requests speech (evidence: `app/tts.py`)
- Speech synthesis → Opus conversion: converts audio (evidence: `app/tts.py`)
- Speech synthesis → Word timing: aligns fallback (evidence: `app/tts.py`)
- Import and batch pipeline → PDF text audio: writes artifacts (evidence: `README.md`)
- Data locations → PDF text audio: locates files (evidence: `app/paths.py`)
- Library index → PDF text audio: indexes artifacts (evidence: `app/db.py`)
- Book catalog → Library index: lists books (evidence: `app/ui/acervo.py`)
- Two-page reader → Library index: loads reading data (evidence: `app/ui/leitura.py`)
- Two-page reader → Import and batch pipeline: requests missing audio (evidence: `app/ui/leitura.py`)
- Two-page reader → Audio playback: plays clips (evidence: `app/ui/leitura.py`)
- Two-page reader → On-demand capacity: checks capacity (evidence: `app/ui/leitura.py`)
- Two-page reader → Text and code view: renders page text (evidence: `app/ui/leitura.py`)
- Text and code view → Syntax highlighting: highlights code (evidence: `app/ui/texto.py`)
- Audio playback → VLC: plays through (evidence: `README.md`)
