+2








902ff00cb0
Co-authored-by: Jason Cameron <git@jasoncameron.dev> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: RequieMa <57754488+RequieMa@users.noreply.github.com> Co-authored-by: prafful <praffulsharma1230@gmail.com> Co-authored-by: M. Sanaullah <thebolly@gmail.com> Co-authored-by: embee <emilien.bev.com@gmail.com> Co-authored-by: Rodrigo <55567123+rodrigodasilv@users.noreply.github.com> Co-authored-by: Emilien Bevierre <44171454+emilienbev@users.noreply.github.com> Co-authored-by: tkhmielnitzky <tkhmielnitzky@gmail.com> Co-authored-by: bnfone <89687390+bnfone@users.noreply.github.com> Co-authored-by: Cyteon <129582290+Cyteon@users.noreply.github.com>
23 lines
471 B
Python
23 lines
471 B
Python
import random
|
|
|
|
from gtts import gTTS
|
|
|
|
from utils import settings
|
|
|
|
|
|
class GTTS:
|
|
def __init__(self):
|
|
self.max_chars = 5000
|
|
self.voices = []
|
|
|
|
def run(self, text, filepath, random_voice: bool = False):
|
|
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)
|