You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
476 B
24 lines
476 B
#!/usr/bin/env python3
|
|
import random
|
|
from utils import settings
|
|
from gtts import gTTS
|
|
|
|
max_chars = 0
|
|
|
|
|
|
class GTTS:
|
|
def __init__(self):
|
|
self.max_chars = 0
|
|
self.voices = []
|
|
|
|
def run(self, text, filepath):
|
|
tts = gTTS(
|
|
text=text,
|
|
lang=settings.config["reddit"]["thread"]["post_lang"] or "en",
|
|
slow=False,
|
|
)
|
|
tts.save(filepath)
|
|
|
|
def randomvoice(self):
|
|
return random.choice(self.voices)
|