Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Add Mozilla TTS connection validation #2828

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mycroft/configuration/mycroft.conf
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@
"voice": "m1"
},
"mozilla": {
"lang": "de",
"url": "http://0.0.0.0:5002/api/tts"
"url": "http://0.0.0.0:5002"
}
},

Expand Down
8 changes: 5 additions & 3 deletions mycroft/tts/mozilla_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, lang="en-us", config=None):
self.config = config
super(MozillaTTS, self).__init__(lang, self.config,
MozillaTTSValidator(self))
self.url = self.config['url']
self.url = self.config['url'] + "/api/tts"
self.type = 'wav'

def get_tts(self, sentence, wav_file):
Expand All @@ -49,8 +49,10 @@ def validate_lang(self):
pass

def validate_connection(self):
# TODO
pass
url = self.tts.config['url']
response = requests.get(url)
if not response.status_code == 200:
raise ConnectionRefusedError

def get_tts_class(self):
return MozillaTTS