|
|
@ -37,7 +37,7 @@ class StreamlabsPolly:
|
|
|
|
voice = self.randomvoice()
|
|
|
|
voice = self.randomvoice()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if not settings.config["settings"]["tts"]["streamlabs_polly_voice"]:
|
|
|
|
if not settings.config["settings"]["tts"]["streamlabs_polly_voice"]:
|
|
|
|
return ValueError(
|
|
|
|
raise ValueError(
|
|
|
|
f"Please set the config variable STREAMLABS_VOICE to a valid voice. options are: {voices}"
|
|
|
|
f"Please set the config variable STREAMLABS_VOICE to a valid voice. options are: {voices}"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
voice = str(settings.config["settings"]["tts"]["streamlabs_polly_voice"]).capitalize()
|
|
|
|
voice = str(settings.config["settings"]["tts"]["streamlabs_polly_voice"]).capitalize()
|
|
|
@ -51,7 +51,7 @@ class StreamlabsPolly:
|
|
|
|
voice_data = requests.get(response.json()["speak_url"])
|
|
|
|
voice_data = requests.get(response.json()["speak_url"])
|
|
|
|
with open(filepath, "wb") as f:
|
|
|
|
with open(filepath, "wb") as f:
|
|
|
|
f.write(voice_data.content)
|
|
|
|
f.write(voice_data.content)
|
|
|
|
except (KeyError, JSONDecodeError) as e:
|
|
|
|
except (KeyError, JSONDecodeError):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if response.json()["error"] == "No text specified!":
|
|
|
|
if response.json()["error"] == "No text specified!":
|
|
|
|
raise ValueError("Please specify a text to convert to speech.")
|
|
|
|
raise ValueError("Please specify a text to convert to speech.")
|
|
|
|