Praxis_Bot/tts.py
dtookey 453c1de0cc Let PEP8 do it's thing and reformat all the files.
Removed bots.py and slurs.py and moved them into config.py. twitch_script_class.py has been updated to handle this
added a test harness for twitch_script_class.py
contains_url and contains_slur are both validated
refactored contains_url to use a simple(ish) regex instead of an if cascade
2020-09-20 11:40:51 -04:00

41 lines
858 B
Python

import os
import datetime
from playsound import playsound
def tts(inputText: str, *args):
destPath = os.getcwd() + "\\tts\\"
time = datetime.datetime.now()
fileName: str = time.strftime("%m-%d-%Y_%H-%M-%S") + "_tts.mp3"
if len(args) == 1:
fileName = args[0] + "_tts.mp3"
# tts = gTTS(text=inputText, lang='en')
# tts.save(destPath + fileName)
playsound(destPath + fileName)
# os.system(filename)
def play_speech(fileName):
destPath = os.getcwd() + "\\tts\\"
playsound(destPath + fileName)
if __name__ == "__main__":
print("Enter Text: ")
textInput = str(input())
print("Custom FileName? y/n: ")
bool_string = str(input())
if bool_string == "y":
print("Enter FileName: ")
fileName = str(input())
tts(textInput, fileName)
else:
tts(textInput)