Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding audiobook script #1407

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Python/audiobook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Installation

Install using [pypi](https://pypi.org/project/audiobook/)

```sh
pip install audiobook
```

## Usages

The audiobook is also available as command line tool.

```bash
audiobook -h
```
check [CLI Documentation ](https://audiobook.readthedocs.io/en/latest/index.html)

## Run with this script

```bash
python script.py <file_path>
```

### Linux Installation Requirements

- If you are using a Linux system and the voice output is not working, then :
Install espeak , ffmpeg and libespeak1 as shown below:

```sh
sudo apt update && sudo apt install espeak ffmpeg libespeak1
```
1 change: 1 addition & 0 deletions Python/audiobook/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
audiobook==2.0.2
27 changes: 27 additions & 0 deletions Python/audiobook/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from audiobook import AudioBook
import argparse

arg = argparse.ArgumentParser()
arg.add_argument("-f", "--file", required=True, help="Path to file")
args = vars(arg.parse_args())

ab = AudioBook(speed="normal") # default speed is normal/slow/fast

def read_book(input_file_path):
""" if you want to read your book """
ab.read_book(input_file_path)

def save_audio(input_file_path):
""" if you want to save your audio books """
ab.save_audio(input_file_path)

if __name__ == "__main__":
input_file_path = args["file"]
read_book(input_file_path)
# save_audio(input_file_path)

# contributor: @codeperfectplus
# full code: https://github.com/Py-Contributors/audiobook
# Pypi: https://pypi.org/project/audiobook/

# requirements.txt audiobook==2.0.2