Skip to main content

A powerful text-to-EPUB conversion tool

Project description

MyEPUBApp

A powerful text-to-EPUB conversion tool that transforms plain text files into standard EPUB e-book format.

Features

  • ๐Ÿ“– Text to EPUB Conversion: Convert plain text files to EPUB-compliant e-books
  • ๐ŸŒ Chinese Optimization: Specially optimized for Chinese content with Chinese book title mark conversion
  • ๐Ÿ“‘ Automatic Chapter Splitting: Automatically identify and split chapters using special marker symbols
  • ๐Ÿ”„ Flexible Modes: Support creating new EPUB or appending chapters to existing EPUB
  • ๐Ÿ—๏ธ Modular Architecture: Clean code structure for easy maintenance and extension
  • ๐Ÿ“ Detailed Logging: Complete operation logging

Installation

Requirements

  • Python 3.8+
  • pip package manager

Option 1: Install from PyPI (Recommended)

pip install myepubapp

Option 2: Install from Source

  1. Clone the project:
git clone https://github.com/eyes1971/myepubapp.git
cd myepubapp
  1. Install dependencies:
pip install -r requirements.txt
  1. Install in development mode:
pip install -e .

Usage

Basic Usage

1. Initialize New EPUB File

python -m myepubapp -i input.txt --output-epub output.epub

่‡ชๅ‹•ๆ›ธๅ็”Ÿๆˆ: ๆ›ธๅๆœƒๅพž่ผธๅ…ฅๆ–‡ไปถๅ่‡ชๅ‹•็”Ÿๆˆ๏ผŒไพ‹ๅฆ‚ my_book.txt ๆœƒ็”Ÿๆˆๆ›ธๅ "My Book"

2. Append Chapters to Existing EPUB

python -m myepubapp -a input.txt --input-epub existing.epub --output-epub new.epub

Command Line Arguments

  • -i, --init: Initialize mode, create new EPUB file
  • -a, --append: Append mode, add chapters to existing EPUB
  • input_file: Input text file path
  • --input-epub, -ie: Existing EPUB file (required in append mode)
  • --output-epub, -o: Output EPUB file path
  • --convert-tags, -ct: Convert <> tags to Chinese book title marks ใ€Šใ€‹

Input File Format

Text files should use the following format for chapter splitting:

โ€ปโ˜† Introduction Content
This is the introduction page content.
It can span multiple paragraphs and will be displayed as a separate introduction page.

โ€ปโ…ฐ Chapter 1 Title
Chapter content first paragraph...

โ€ปโ…ฑ Chapter 1 Section 1 Subsection Title
Subsection content...

โ€ปโ…ฒ Chapter 1 Section 1 Subsection 1
Deeper level content...

Format Description:

  • โ€ปโ˜†: Introduction page (creates a separate intro page)
  • โ€ปโ…ฐ: Level 1 chapter (h1)
  • โ€ปโ…ฑ: Level 2 chapter (h2)
  • โ€ปโ…ฒ: Level 3 chapter (h3)

Examples

Create Simple EPUB

python -m myepubapp -i sample.txt --output-epub mybook.epub

Create EPUB with Tag Conversion

python -m myepubapp -i sample.txt --output-epub mybook.epub --convert-tags

Append Chapters to Existing EPUB

python -m myepubapp -a chapter2.txt --input-epub mybook.epub --output-epub mybook_updated.epub

Dependencies

  • ebooklib>=0.18.0: EPUB file processing
  • beautifulsoup4>=4.12.0: HTML/XML parsing

Project Structure

myepubapp/
โ”œโ”€โ”€ core/                 # Core modules
โ”‚   โ”œโ”€โ”€ book.py          # EPUB book class
โ”‚   โ”œโ”€โ”€ chapter.py       # Chapter class
โ”‚   โ””โ”€โ”€ metadata.py      # Metadata class
โ”œโ”€โ”€ generators/          # Generator modules
โ”‚   โ”œโ”€โ”€ content.py       # Content generator
โ”‚   โ””โ”€โ”€ toc.py          # Table of contents generator
โ”œโ”€โ”€ utils/               # Utility modules
โ”‚   โ”œโ”€โ”€ file_handler.py  # File handling
โ”‚   โ”œโ”€โ”€ logger.py        # Logging
โ”‚   โ””โ”€โ”€ text_processor.py # Text processing
โ”œโ”€โ”€ exceptions/          # Custom exceptions
โ”‚   โ””โ”€โ”€ epub_exceptions.py
โ”œโ”€โ”€ cli.py              # Command line interface
โ””โ”€โ”€ __init__.py         # Package initialization

Logging

All operations are logged to logs/myepubapp.log file.

License

This project is licensed under the MIT License.

Contributing

Issues and Pull Requests are welcome!

Version

Current version: 1.0.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myepubapp-1.0.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

myepubapp-1.0.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file myepubapp-1.0.0.tar.gz.

File metadata

  • Download URL: myepubapp-1.0.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for myepubapp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 736f8e28a235b7d5f90cb32d495b72c807b22996e46cf1c45bba9677dbeac418
MD5 3a110827a88f7f7ccf8758f4ed8247b8
BLAKE2b-256 f9f25c32862325537702808e1cd39853f5b35bd9ad4281bef82d3659166fc973

See more details on using hashes here.

File details

Details for the file myepubapp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: myepubapp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for myepubapp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e10325aee75b1b64f9fd0b927a5963bc484ae37a11cdcea888693b699cf71073
MD5 b9612446bc25e504350f958edab26647
BLAKE2b-256 9a8a60b3f6c4106a5e2dadb6eee1147acd21553598ce438ac525e431e884ca3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page