77 lines
1.4 KiB
Markdown
77 lines
1.4 KiB
Markdown
# EPUB to Obsidian Converter
|
|
|
|
Convert EPUB books to Obsidian Markdown notes with proper chapter structure and frontmatter.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
# Install dependencies
|
|
pip install html2text beautifulsoup4
|
|
|
|
# Ensure Calibre is installed (for ebook-convert)
|
|
scoop install calibre
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Command Line
|
|
|
|
```bash
|
|
python -m tools.epub_converter <input.epub> <output_dir> [--author "Author"] [--tags "tag1,tag2"]
|
|
|
|
# Example
|
|
python -m tools.epub_converter "book.epub" "output_folder" --author "Author Name" --tags "tag1,tag2"
|
|
```
|
|
|
|
### Python API
|
|
|
|
```python
|
|
from tools.epub_converter import EpubConverter
|
|
|
|
converter = EpubConverter()
|
|
files = converter.convert(
|
|
"input.epub",
|
|
"output_dir",
|
|
author="Author Name",
|
|
tags=["tag1", "tag2"]
|
|
)
|
|
print(f"Created {len(files)} files")
|
|
```
|
|
|
|
## Features
|
|
|
|
- Extracts metadata from EPUB (title, author, publisher, date)
|
|
- Handles OEBPS format with anchor-based TOC
|
|
- Calibre normalization for complex EPUB structures
|
|
- Splits into per-chapter Obsidian notes
|
|
- Standard YAML frontmatter for Obsidian
|
|
|
|
## Output Format
|
|
|
|
Each chapter file includes:
|
|
|
|
```yaml
|
|
---
|
|
title: "Chapter Title"
|
|
categories:
|
|
- "[[LLM Wiki]]"
|
|
- "[[Books]]"
|
|
tags:
|
|
- book
|
|
- epub
|
|
- custom-tags
|
|
book: "[[Book Title]]"
|
|
author: "[[Author Name]]"
|
|
section: "Section Name"
|
|
created: "YYYY-MM-DD"
|
|
type: book-chapter
|
|
---
|
|
```
|
|
|
|
## Requirements
|
|
|
|
- Python 3.10+
|
|
- Calibre (ebook-convert)
|
|
- html2text (recommended)
|
|
- beautifulsoup4 (optional fallback)
|