diff --git a/homeassistant/components/tts/__init__.py b/homeassistant/components/tts/__init__.py index c175290f451..bbef4d57e45 100644 --- a/homeassistant/components/tts/__init__.py +++ b/homeassistant/components/tts/__init__.py @@ -29,9 +29,10 @@ from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_per_platform import homeassistant.helpers.config_validation as cv +REQUIREMENTS = ["mutagen==1.37.0"] + DOMAIN = 'tts' DEPENDENCIES = ['http'] -REQUIREMENTS = ["mutagen==1.36.2"] _LOGGER = logging.getLogger(__name__) @@ -79,7 +80,7 @@ SCHEMA_SERVICE_CLEAR_CACHE = vol.Schema({}) @asyncio.coroutine def async_setup(hass, config): - """Setup TTS.""" + """Set up TTS.""" tts = SpeechManager(hass) try: @@ -101,7 +102,7 @@ def async_setup(hass, config): @asyncio.coroutine def async_setup_platform(p_type, p_config, disc_info=None): - """Setup a tts platform.""" + """Set up a tts platform.""" platform = yield from async_prepare_setup_platform( hass, config, DOMAIN, p_type) if platform is None: @@ -116,12 +117,12 @@ def async_setup(hass, config): None, platform.get_engine, hass, p_config) if provider is None: - _LOGGER.error('Error setting up platform %s', p_type) + _LOGGER.error("Error setting up platform %s", p_type) return tts.async_register_engine(p_type, provider, p_config) except Exception: # pylint: disable=broad-except - _LOGGER.exception('Error setting up platform %s', p_type) + _LOGGER.exception("Error setting up platform %s", p_type) return @asyncio.coroutine @@ -209,8 +210,7 @@ class SpeechManager(object): self.cache_dir = yield from self.hass.loop.run_in_executor( None, init_tts_cache_dir, cache_dir) except OSError as err: - raise HomeAssistantError( - "Can't init cache dir {}".format(err)) + raise HomeAssistantError("Can't init cache dir {}".format(err)) def get_cache_files(): """Return a dict of given engine files.""" @@ -231,8 +231,7 @@ class SpeechManager(object): cache_files = yield from self.hass.loop.run_in_executor( None, get_cache_files) except OSError as err: - raise HomeAssistantError( - "Can't read cache dir {}".format(err)) + raise HomeAssistantError("Can't read cache dir {}".format(err)) if cache_files: self.file_cache.update(cache_files) @@ -273,14 +272,14 @@ class SpeechManager(object): msg_hash = hashlib.sha1(bytes(message, 'utf-8')).hexdigest() use_cache = cache if cache is not None else self.use_cache - # languages + # Languages language = language or provider.default_language if language is None or \ language not in provider.supported_languages: raise HomeAssistantError("Not supported language {0}".format( language)) - # options + # Options if provider.default_options and options: options = provider.default_options.copy().update(options) options = options or provider.default_options @@ -297,14 +296,14 @@ class SpeechManager(object): key = KEY_PATTERN.format( msg_hash, language, options_key, engine).lower() - # is speech allready in memory + # Is speech already in memory if key in self.mem_cache: filename = self.mem_cache[key][MEM_CACHE_FILENAME] - # is file store in file cache + # Is file store in file cache elif use_cache and key in self.file_cache: filename = self.file_cache[key] self.hass.async_add_job(self.async_file_to_mem(key)) - # load speech from provider into memory + # Load speech from provider into memory else: filename = yield from self.async_get_tts_audio( engine, key, message, use_cache, language, options) @@ -327,13 +326,13 @@ class SpeechManager(object): raise HomeAssistantError( "No TTS from {} for '{}'".format(engine, message)) - # create file infos + # Create file infos filename = ("{}.{}".format(key, extension)).lower() data = self.write_tags( filename, data, provider, message, language, options) - # save to memory + # Save to memory self._async_store_to_memcache(key, filename, data) if cache: diff --git a/requirements_all.txt b/requirements_all.txt index 41df2f8221e..4c48b4f6a8d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -392,7 +392,7 @@ mficlient==0.3.0 miflora==0.1.16 # homeassistant.components.tts -mutagen==1.36.2 +mutagen==1.37.0 # homeassistant.components.sensor.usps myusps==1.0.5