https://github.com/taylor-eos/txt-to-epub
Converts a text input into an EPUB
https://github.com/taylor-eos/txt-to-epub
Last synced: about 1 month ago
JSON representation
Converts a text input into an EPUB
- Host: GitHub
- URL: https://github.com/taylor-eos/txt-to-epub
- Owner: Taylor-eOS
- Created: 2024-06-09T07:17:21.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-16T00:35:26.000Z (over 1 year ago)
- Last Synced: 2025-02-16T01:21:46.494Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 67.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This script takes blocks of text from an input TXT file and wraps them into EPUB. It is a lightweight tool, written by an amateur, with a chatbot.
The script structures chapters and adds metadata and a cover image.\
The current state of the project is that it works, but doesn't nest chapters or superscript footnote references. The resulting files will be readable, but a little crude.
### How to Use `txt-to-epub`
1. **Pre-process the Text**: The input needs to be in a particular format, which can be extracted from PDF using [maual-classifier](https://github.com/Taylor-eOS/manual-classifier).
2. Before running the main script, use `pre_processing.py` to combine the blocks properly. (This was tested on particular files, and might need adaptation with some input formats.)
```bash
python pre_processing.py input.txt
```
This will generate a cleaned text file ready for EPUB conversion.
3. Edit `metadata.json` to contain your author and title data.
4. **Generate the EPUB**: Run `create_epub.py` to convert your cleaned text file to EPUB format. If you plae a cover image (`cover.jpg`) in the folder, it will be used.
```bash
python create_epub.py cleaned_input.txt metadata.json
```
The script should output a properly formatted EPUB file named after the book title, that can be read on e-readers.