Remove fuzzy language matching from stt and tts (#92002)
* Remove fuzzy language matching from stt and tts * Update tests
This commit is contained in:
parent
d1e6e4078c
commit
792ea92e55
11 changed files with 57 additions and 97 deletions
|
@ -11,7 +11,6 @@ from homeassistant.core import HomeAssistant, callback
|
|||
from homeassistant.helpers import config_per_platform, discovery
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import async_prepare_setup_platform
|
||||
from homeassistant.util import language as language_util
|
||||
|
||||
from .const import (
|
||||
DATA_PROVIDERS,
|
||||
|
@ -163,18 +162,9 @@ class Provider(ABC):
|
|||
@callback
|
||||
def check_metadata(self, metadata: SpeechMetadata) -> bool:
|
||||
"""Check if given metadata supported by this provider."""
|
||||
if metadata.language not in self.supported_languages:
|
||||
language_matches = language_util.matches(
|
||||
metadata.language,
|
||||
self.supported_languages,
|
||||
)
|
||||
if language_matches:
|
||||
metadata.language = language_matches[0]
|
||||
else:
|
||||
return False
|
||||
|
||||
if (
|
||||
metadata.format not in self.supported_formats
|
||||
metadata.language not in self.supported_languages
|
||||
or metadata.format not in self.supported_formats
|
||||
or metadata.codec not in self.supported_codecs
|
||||
or metadata.bit_rate not in self.supported_bit_rates
|
||||
or metadata.sample_rate not in self.supported_sample_rates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue