# mackenziet7/ao3-epub-to-odt architecture

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

- Interactive diagram: https://gitdiagram.com/mackenziet7/ao3-epub-to-odt
- Repository: https://github.com/mackenziet7/ao3-epub-to-odt

## Overview

AO3 EPUB to ODT Converter is a Windows desktop app for turning AO3 EPUBs into editable, print-ready ODT books. Users select an EPUB and output folder, configure layout, typography and options in a wizard—or choose a saved preset for quick conversion—then monitor progress and receive an ODT. The documented output includes book matter, chapters, optional QR and contents, running headers, and an author-notes appendix. The graph follows the sampled GUI-to-worker path and indexed converter modules; internal writer call details are limited where source excerpts do not show them.

Main entry points: [`gui/worker.py`](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/worker.py) (Conversion worker), [`scripts/script_ao3_to_odt.py`](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/script_ao3_to_odt.py) (ODT conversion runner), [`gui/wiring/page0_wiring.py`](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/wiring/page0_wiring.py) (File selection), [`gui/wiring`](https://github.com/mackenziet7/ao3-epub-to-odt/tree/main/gui/wiring) (Book setup wizard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gui["Desktop workflow"]
  node_app["App window<br/>[main_window.py]"]
  node_input["File selection<br/>[page0_wiring.py]"]
  node_wizard["Book setup wizard"]
  node_preview["Page preview"]
end

subgraph group_settings["Settings and presets"]
  node_settings[("App settings<br/>[config.py]")]
  node_preset_ui["Preset controls<br/>[page4_wiring.py]"]
  node_preset_map["Wizard settings mapping<br/>[preset_builder.py]"]
  node_preset_schema["Preset validation<br/>[preset_schema.py]"]
end

subgraph group_conversion["EPUB conversion"]
  node_worker["Conversion worker<br/>[worker.py]"]
  node_epub["AO3 EPUB"]
  node_parser["EPUB parser<br/>[parser.py]"]
  node_models["Book model<br/>[models.py]"]
  node_qr["QR generation<br/>[qr.py]"]
end

subgraph group_document["ODT generation"]
  node_runner["ODT conversion runner"]
  node_connection["UNO connection<br/>[connection.py]"]
  node_content["Book content writer<br/>[content.py]"]
  node_styles["Document styles<br/>[styles.py]"]
  node_headers["Running headers<br/>[headers.py]"]
  node_odt["Print-ready ODT"]
end

node_user(("Reader"))
node_libreoffice["LibreOffice UNO"]

node_user -->|"selects EPUB"| node_input
node_user -->|"sets book options"| node_wizard
node_app -->|"hosts workflow"| node_input
node_app -->|"wires pages"| node_wizard
node_wizard -->|"updates preview"| node_preview
node_input -->|"starts conversion"| node_worker
node_wizard -->|"starts conversion"| node_worker
node_input -->|"reads preferences"| node_settings
node_preset_ui -->|"applies preset"| node_preset_map
node_preset_map -->|"uses schema"| node_preset_schema
node_worker -->|"parses EPUB"| node_parser
node_worker -->|"serializes book"| node_models
node_worker -->|"generates optional QR"| node_qr
node_worker -->|"launches runner"| node_runner
node_epub -->|"provides input"| node_worker
node_runner -->|"uses UNO connection"| node_connection
node_runner -->|"uses content writer"| node_content
node_runner -->|"uses style writer"| node_styles
node_runner -->|"uses header writer"| node_headers
node_connection -->|"connects to"| node_libreoffice
node_content -->|"writes document"| node_odt
node_styles -->|"formats document"| node_odt
node_headers -->|"adds running headers"| node_odt

click node_app "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/main_window.py"
click node_input "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/wiring/page0_wiring.py"
click node_wizard "https://github.com/mackenziet7/ao3-epub-to-odt/tree/main/gui/wiring"
click node_preview "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/widgets/page_preview_widget.py"
click node_settings "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/config.py"
click node_preset_ui "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/wiring/page4_wiring.py"
click node_preset_map "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/wiring/preset_builder.py"
click node_preset_schema "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/preset_schema.py"
click node_worker "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/worker.py"
click node_parser "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/epub/parser.py"
click node_models "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/epub/models.py"
click node_qr "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/qr.py"
click node_runner "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/script_ao3_to_odt.py"
click node_connection "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/connection.py"
click node_content "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/content.py"
click node_styles "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/styles.py"
click node_headers "https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/headers.py"

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,node_input,node_wizard,node_preview toneBlue
class node_settings,node_preset_ui,node_preset_map,node_preset_schema toneAmber
class node_worker,node_epub,node_parser,node_models,node_qr toneMint
class node_runner,node_connection,node_content,node_styles,node_headers,node_odt toneRose
class node_user,node_libreoffice toneIndigo
```

## Components

### Desktop workflow

- [App window](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/main_window.py): `gui/main_window.py`
- [File selection](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/wiring/page0_wiring.py): `gui/wiring/page0_wiring.py`
- [Book setup wizard](https://github.com/mackenziet7/ao3-epub-to-odt/tree/main/gui/wiring): `gui/wiring`
- [Page preview](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/widgets/page_preview_widget.py): `gui/widgets/page_preview_widget.py`

### Settings and presets

- [App settings](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/config.py): `gui/config.py`
- [Preset controls](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/wiring/page4_wiring.py): `gui/wiring/page4_wiring.py`
- [Wizard settings mapping](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/wiring/preset_builder.py): `gui/wiring/preset_builder.py`
- [Preset validation](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/preset_schema.py): `scripts/ao3_to_odt/preset_schema.py`

### EPUB conversion

- [Conversion worker](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/gui/worker.py): `gui/worker.py`
- **AO3 EPUB**
- [EPUB parser](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/epub/parser.py): `scripts/ao3_to_odt/epub/parser.py`
- [Book model](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/epub/models.py): `scripts/ao3_to_odt/epub/models.py`
- [QR generation](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/qr.py): `scripts/ao3_to_odt/qr.py`

### ODT generation

- [ODT conversion runner](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/script_ao3_to_odt.py): `scripts/script_ao3_to_odt.py`
- [UNO connection](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/connection.py): `scripts/ao3_to_odt/writer/connection.py`
- [Book content writer](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/content.py): `scripts/ao3_to_odt/writer/content.py`
- [Document styles](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/styles.py): `scripts/ao3_to_odt/writer/styles.py`
- [Running headers](https://github.com/mackenziet7/ao3-epub-to-odt/blob/main/scripts/ao3_to_odt/writer/headers.py): `scripts/ao3_to_odt/writer/headers.py`
- **Print-ready ODT**

### Other components

- **Reader**
- **LibreOffice UNO**

## Connections

- Reader → File selection: selects EPUB (evidence: `README.md`)
- Reader → Book setup wizard: sets book options (evidence: `README.md`)
- App window → File selection: hosts workflow (evidence: `gui/main_window.py`)
- App window → Book setup wizard: wires pages (evidence: `gui/main_window.py`)
- Book setup wizard → Page preview: updates preview (evidence: `gui/wiring/page1_wiring.py`)
- File selection → Conversion worker: starts conversion
- Book setup wizard → Conversion worker: starts conversion (evidence: `README.md`)
- File selection → App settings: reads preferences (evidence: `gui/wiring/page0_wiring.py`)
- Preset controls → Wizard settings mapping: applies preset (evidence: `gui/wiring/page6_wiring.py`)
- Wizard settings mapping → Preset validation: uses schema (evidence: `gui/wiring/preset_builder.py`)
- Conversion worker → EPUB parser: parses EPUB (evidence: `gui/worker.py`)
- Conversion worker → Book model: serializes book (evidence: `gui/worker.py`)
- Conversion worker → QR generation: generates optional QR (evidence: `gui/worker.py`)
- Conversion worker → ODT conversion runner: launches runner (evidence: `gui/worker.py`)
- AO3 EPUB → Conversion worker: provides input (evidence: `README.md`)
- ODT conversion runner → UNO connection: uses UNO connection (evidence: `scripts/script_ao3_to_odt.py`)
- ODT conversion runner → Book content writer: uses content writer (evidence: `scripts/script_ao3_to_odt.py`)
- ODT conversion runner → Document styles: uses style writer (evidence: `scripts/script_ao3_to_odt.py`)
- ODT conversion runner → Running headers: uses header writer (evidence: `scripts/script_ao3_to_odt.py`)
- UNO connection → LibreOffice UNO: connects to (evidence: `README.md`)
- Book content writer → Print-ready ODT: writes document (evidence: `README.md`)
- Document styles → Print-ready ODT: formats document (evidence: `README.md`)
- Running headers → Print-ready ODT: adds running headers (evidence: `README.md`)
