Skip to content

Commit

Permalink
Google TTS can't read percent sign (#6971) (#7030)
Browse files Browse the repository at this point in the history
  • Loading branch information
pezinek authored and pvizeli committed Apr 11, 2017
1 parent aa3ccf1 commit 197db6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/tts/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def async_get_tts_audio(self, message, language, options=None):
url_param = {
'ie': 'UTF-8',
'tl': language,
'q': yarl.quote(part),
'q': yarl.quote(part, strict=False),
'tk': part_token,
'total': len(message_parts),
'idx': idx,
Expand Down
15 changes: 8 additions & 7 deletions tests/components/tts/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def setup_method(self):
self.url = "http://translate.google.com/translate_tts"
self.url_param = {
'tl': 'en',
'q': 'I%20person%20is%20on%20front%20of%20your%20door.',
'q':
'90%25%20of%20I%20person%20is%20on%20front%20of%20your%20door.',
'tk': 5,
'client': 'tw-ob',
'textlen': 34,
'textlen': 41,
'total': 1,
'idx': 0,
'ie': 'UTF-8',
Expand Down Expand Up @@ -70,7 +71,7 @@ def test_service_say(self, mock_calculate, aioclient_mock):
setup_component(self.hass, tts.DOMAIN, config)

self.hass.services.call(tts.DOMAIN, 'google_say', {
tts.ATTR_MESSAGE: "I person is on front of your door.",
tts.ATTR_MESSAGE: "90% of I person is on front of your door.",
})
self.hass.block_till_done()

Expand Down Expand Up @@ -99,7 +100,7 @@ def test_service_say_german_config(self, mock_calculate, aioclient_mock):
setup_component(self.hass, tts.DOMAIN, config)

self.hass.services.call(tts.DOMAIN, 'google_say', {
tts.ATTR_MESSAGE: "I person is on front of your door.",
tts.ATTR_MESSAGE: "90% of I person is on front of your door.",
})
self.hass.block_till_done()

Expand All @@ -126,7 +127,7 @@ def test_service_say_german_service(self, mock_calculate, aioclient_mock):
setup_component(self.hass, tts.DOMAIN, config)

self.hass.services.call(tts.DOMAIN, 'google_say', {
tts.ATTR_MESSAGE: "I person is on front of your door.",
tts.ATTR_MESSAGE: "90% of I person is on front of your door.",
tts.ATTR_LANGUAGE: "de"
})
self.hass.block_till_done()
Expand All @@ -153,7 +154,7 @@ def test_service_say_error(self, mock_calculate, aioclient_mock):
setup_component(self.hass, tts.DOMAIN, config)

self.hass.services.call(tts.DOMAIN, 'google_say', {
tts.ATTR_MESSAGE: "I person is on front of your door.",
tts.ATTR_MESSAGE: "90% of I person is on front of your door.",
})
self.hass.block_till_done()

Expand All @@ -179,7 +180,7 @@ def test_service_say_timeout(self, mock_calculate, aioclient_mock):
setup_component(self.hass, tts.DOMAIN, config)

self.hass.services.call(tts.DOMAIN, 'google_say', {
tts.ATTR_MESSAGE: "I person is on front of your door.",
tts.ATTR_MESSAGE: "90% of I person is on front of your door.",
})
self.hass.block_till_done()

Expand Down

0 comments on commit 197db6b

Please sign in to comment.