Skip to content

Commit

Permalink
Merge pull request #58 from aedocw/main
Browse files Browse the repository at this point in the history
To build docker image
  • Loading branch information
aedocw authored Nov 9, 2023
2 parents a03e016 + 3148fe8 commit 4098012
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,29 @@ To specify bitrate (ex 30k): `--bitrate 30k`

If epub2tts is interrupted or crashes, you can run it again with the same parameters and it will pick up where it left off, assuming it made it far enough to save some WAV files. If you want to start fresh, be sure to delete any of the wav files (with the same name as the epub) in the working directory before running again.

## DOCKER INSTALLATION:
## DOCKER INSTRUCTIONS:
Voice models will be saved locally in `~/.local/share/tts`

For *Linux and MacOS*:
```
alias epub2tts='docker run -v "$PWD:$PWD" -v ~/.local/share/tts:/root/.local/share/tts -w "$PWD" ghcr.io/aedocw/epub2tts:release'
```

For *Windows*:
Pre-requisites:
* Install Docker Desktop
* From PowerShell run "mkdir ~/.local/share/tts"

```
#Example for running scan of "mybook.epub"
docker run -v ${PWD}/.local/share/tts:/root/.local/share/tts -v ${PWD}:/root -w /root ghcr.io/aedocw/epub2tts:release mybook.epub --scan
#Example for reading parts 3 through 15 of "mybook.epub"
docker run -v ${PWD}/.local/share/tts:/root/.local/share/tts -v ${PWD}:/root -w /root ghcr.io/aedocw/epub2tts:release mybook.epub --start 3 --end 15
```

## MAC INSTALLATION:
This installation requires Python 3.10 and [Homebrew](https://brew.sh/) (I use homebrew to install espeak, [pyenv](https://stackoverflow.com/questions/36968425/how-can-i-install-multiple-versions-of-python-on-latest-os-x-and-use-them-in-par) and ffmpeg). Per [this bug](https://github.com/coqui-ai/TTS/issues/2052), mecab should also be installed via homebrew.
This installation requires Python < 3.12 and [Homebrew](https://brew.sh/) (I use homebrew to install espeak, [pyenv](https://stackoverflow.com/questions/36968425/how-can-i-install-multiple-versions-of-python-on-latest-os-x-and-use-them-in-par) and ffmpeg). Per [this bug](https://github.com/coqui-ai/TTS/issues/2052), mecab should also be installed via homebrew.

Voice models will be saved locally in `~/.local/share/tts`
```
Expand All @@ -46,16 +60,16 @@ brew install espeak pyenv ffmpeg mecab
#install epub2tts
git clone https://github.com/aedocw/epub2tts
cd epub2tts
pyenv install 3.10.11
pyenv local 3.10.11
pyenv install 3.11
pyenv local 3.11
#OPTIONAL - install this in a virtual environment
python -m venv .venv && source .venv/bin/activate
pip install .
```

## LINUX INSTALLATION:

For now I've only tested this on a linux machine (Ubuntu 22 in my case). Ensure you have `ffmpeg` installed before use.
These instructions are for Ubuntu, but should work (with appropriate package installer mods) for just about any repo. Ensure you have `ffmpeg` installed before use.

Voice models will be saved locally in `~/.local/share/tts`

Expand All @@ -70,8 +84,6 @@ pip install .

## DEVELOPMENT INSTALL:

For now I've only tested this on a linux machine (Ubuntu 22 in my case)

```
#clone the repo
git clone https://github.com/aedocw/epub2tts
Expand Down
6 changes: 5 additions & 1 deletion epub2tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import os
import requests
import string
import subprocess
import sys
import time
Expand Down Expand Up @@ -156,7 +157,10 @@ def get_chapters_epub(book, bookname):
for i in range(len(chapters)):
#strip some characters that might have caused TTS to choke
text = chap2text(chapters[i])
text = text.translate({ord(c): None for c in '[]*'})
#this still misses a lot of special characters...
#text = text.translate({ord(c): None for c in '[]*“”"\''})
allowed_chars = string.ascii_letters + string.digits + '-,.!? '
text = ''.join(c for c in text if c in allowed_chars)
if len(text) < 150:
#too short to bother with
continue
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
author_email='doc@aedo.net',
url='https://github.com/aedocw/epub2tts',
license='Apache License, Version 2.0',
version='1.3.9',
version='1.3.12',
packages=find_packages(),
install_requires=requirements,
py_modules=['epub2tts'],
Expand Down

0 comments on commit 4098012

Please sign in to comment.