mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
Handle missing attributes in win32 tts code
https://forums.ankiweb.net/t/trouble-adding-tts-to-my-cards/21792/4
This commit is contained in:
parent
2e2fc799e2
commit
d699bc1252
1 changed files with 11 additions and 2 deletions
|
@ -496,9 +496,18 @@ if is_win:
|
|||
]
|
||||
|
||||
def _voice_to_objects(self, voice: Any) -> list[WindowsVoice]:
|
||||
langs = voice.GetAttribute("language")
|
||||
try:
|
||||
langs = voice.GetAttribute("language")
|
||||
except:
|
||||
# no associated language; ignore
|
||||
return []
|
||||
langs = lcid_hex_str_to_lang_codes(langs)
|
||||
name = self._tidy_name(voice.GetAttribute("name"))
|
||||
try:
|
||||
name = voice.GetAttribute("name")
|
||||
except:
|
||||
# some voices may not have a name
|
||||
name = "unknown"
|
||||
name = self._tidy_name(name)
|
||||
return [WindowsVoice(name=name, lang=lang, handle=voice) for lang in langs]
|
||||
|
||||
def _play(self, tag: AVTag) -> None:
|
||||
|
|
Loading…
Reference in a new issue