diff --git a/System-Automation-Scripts/Story Reader/Readme.md b/System-Automation-Scripts/Story Reader/Readme.md new file mode 100644 index 00000000..9c344b3b --- /dev/null +++ b/System-Automation-Scripts/Story Reader/Readme.md @@ -0,0 +1,13 @@ +[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) + +
+ +
+ +# Audiobook + +Read any audio book from pdf using python. + +### Modules used: + 1. PyPDF2 + 2. Pyttsx3 diff --git a/System-Automation-Scripts/Story Reader/audiobook.png b/System-Automation-Scripts/Story Reader/audiobook.png new file mode 100644 index 00000000..4e015dca Binary files /dev/null and b/System-Automation-Scripts/Story Reader/audiobook.png differ diff --git a/System-Automation-Scripts/Story Reader/main.py b/System-Automation-Scripts/Story Reader/main.py new file mode 100644 index 00000000..a8dd39bf --- /dev/null +++ b/System-Automation-Scripts/Story Reader/main.py @@ -0,0 +1,18 @@ +from time import sleep + +import pyttsx3 #pip install pyttsx3 +import PyPDF2 #pip install PyPDF2 + +story = open('mybook.pdf', 'rb') #Name of your script make sure it's in pdf format +pdfReader = PyPDF2.PdfFileReader(story) +pages = pdfReader.numPages +# pages = pdfReader.getPage(number) Replace nu,ber with any specific page number you want this to read +engine = pyttsx3.init() +voices = engine.getProperty('voices') +engine.setProperty('voice', voices[0].id) #For male voice change the value to 1. + +for num in range(0, pages): + page = pdfReader.getPage(num) + text = page.extractText() + engine.say(text) + engine.runAndWait() \ No newline at end of file diff --git a/System-Automation-Scripts/Story Reader/mybook.pdf b/System-Automation-Scripts/Story Reader/mybook.pdf new file mode 100644 index 00000000..fbb3039e Binary files /dev/null and b/System-Automation-Scripts/Story Reader/mybook.pdf differ