|
|
@ -46,8 +46,12 @@ 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):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if response.json()["error"] == "No text specified!":
|
|
|
|
|
|
|
|
raise ValueError('Please specify a text to convert to speech.')
|
|
|
|
except (KeyError, JSONDecodeError):
|
|
|
|
except (KeyError, JSONDecodeError):
|
|
|
|
print("Error occurred calling Streamlabs Polly")
|
|
|
|
print("Error occurred calling Streamlabs Polly")
|
|
|
|
|
|
|
|
|
|
|
|
def randomvoice(self):
|
|
|
|
def randomvoice(self):
|
|
|
|
return random.choice(self.voices)
|
|
|
|
return random.choice(self.voices)
|
|
|
|
|
|
|
|
#StreamlabsPolly().run(text=str('hi hi ' * 92)[1:], filepath='hello.mp3', random_voice=True)
|
|
|
|