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 3 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
64 changes: 64 additions & 0 deletions Python/audiobook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## Installation

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

```sh
pip install audiobook
```

```python
from audiobook import AudioBook
ab = AudioBook(speed="normal") # argument: Speech-Speed="slow/normal/fast"

ab.save_audio(file_path, password=None) # save audio file
ab.read_book(file_path, password=None) # listen to the book
```

## Usages

The audiobook is a python module for listening to your favourite PDF book.

## Test

Run tests:

```sh
pip install -r requirements.txt
python -m unittest tests
```

## Documentation

Read Detailed [Documentation here](https://audiobook.readthedocs.io/)

### 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
```

## Roadmap

- Speech-Speed Control
- Support more extensions
- Save the audiobook for future

## Project status

This project is currently in development. Any contributions are welcome.

## Changelog

**V2.0.0**

- [x] Save Audio Book locally
- [x] Listen to the book
- [x] Speech-speed control
- [x] Read password-protected PDF
- [x] Create JSON file for the book
- [ ] Change the voice of the narrator

- [ ] Support more extensions
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.0
28 changes: 28 additions & 0 deletions Python/audiobook/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.create_json_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.0