mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Make RT import statement conditional, fix formatting, ignore WinRT for type checking
This commit is contained in:
parent
ac78698a1e
commit
a30064d5e9
2 changed files with 6 additions and 4 deletions
|
@ -917,11 +917,13 @@ def setup_audio(taskman: TaskManager, base_folder: str) -> None:
|
||||||
|
|
||||||
av_player.players.append(MacTTSPlayer(taskman))
|
av_player.players.append(MacTTSPlayer(taskman))
|
||||||
elif isWin:
|
elif isWin:
|
||||||
from aqt.tts import WindowsRTTTSFilePlayer, WindowsTTSPlayer
|
from aqt.tts import WindowsTTSPlayer
|
||||||
|
|
||||||
av_player.players.append(WindowsTTSPlayer(taskman))
|
av_player.players.append(WindowsTTSPlayer(taskman))
|
||||||
|
|
||||||
if platform.release() == "10":
|
if platform.release() == "10":
|
||||||
|
from aqt.tts import WindowsRTTTSFilePlayer
|
||||||
|
|
||||||
# If Windows 10, ensure it's October 2018 update or later
|
# If Windows 10, ensure it's October 2018 update or later
|
||||||
if int(platform.version().split(".")[-1]) >= 17763:
|
if int(platform.version().split(".")[-1]) >= 17763:
|
||||||
av_player.players.append(WindowsRTTTSFilePlayer(taskman))
|
av_player.players.append(WindowsRTTTSFilePlayer(taskman))
|
||||||
|
|
|
@ -529,7 +529,7 @@ if isWin:
|
||||||
tmppath = os.path.join(tmpdir(), "tts.wav")
|
tmppath = os.path.join(tmpdir(), "tts.wav")
|
||||||
|
|
||||||
def import_voices(self) -> None:
|
def import_voices(self) -> None:
|
||||||
import winrt.windows.media.speechsynthesis as speechsynthesis
|
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||||
|
|
||||||
self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices()
|
self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices()
|
||||||
|
|
||||||
|
@ -569,8 +569,8 @@ if isWin:
|
||||||
cb()
|
cb()
|
||||||
|
|
||||||
async def speakText(self, tag: TTSTag, voice_id):
|
async def speakText(self, tag: TTSTag, voice_id):
|
||||||
import winrt.windows.media.speechsynthesis as speechsynthesis
|
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||||
import winrt.windows.storage.streams as streams
|
import winrt.windows.storage.streams as streams # type: ignore
|
||||||
|
|
||||||
synthesizer = speechsynthesis.SpeechSynthesizer()
|
synthesizer = speechsynthesis.SpeechSynthesizer()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue