Fix TTS handling on Windows
Also update to winsdk, which unblocks Python updates on Windows
This commit is contained in:
parent
ca1166990c
commit
a70f8d4dd5
@ -44,4 +44,4 @@ good-names =
|
||||
ip,
|
||||
|
||||
[IMPORTS]
|
||||
ignored-modules = anki.*_pb2, anki.sync_pb2, win32file,pywintypes,socket,win32pipe,winrt,pyaudio,anki.scheduler_pb2
|
||||
ignored-modules = anki.*_pb2, anki.sync_pb2, win32file,pywintypes,socket,win32pipe,winsdk,pyaudio,anki.scheduler_pb2
|
||||
|
@ -15,10 +15,10 @@ Pre-built Python packages are available on PyPI. They are useful if you wish to:
|
||||
- Get code completion when developing add-ons
|
||||
- Make command line scripts that modify .anki2 files via Anki's Python libraries
|
||||
|
||||
You will need the 64 bit version of Python 3.9 or 3.10 installed. 3.9 is
|
||||
recommended, as Anki has only received minimal testing on 3.10 so far, and some
|
||||
dependencies have not been fully updated yet. On Windows, currently only 3.9
|
||||
will work. You can install Python from python.org or from your distro.
|
||||
You will need the 64 bit version of Python 3.9 or later installed. 3.9 is
|
||||
recommended, as Anki has only received minimal testing on 3.10+ so far, and some
|
||||
dependencies have not been fully updated yet. You can install Python from python.org
|
||||
or from your distro.
|
||||
|
||||
For further instructions, please see https://betas.ankiweb.net/#via-pypipip. Note that
|
||||
in the provided commands, `--pre` tells pip to fetch alpha/beta versions. If you remove
|
||||
|
@ -7,4 +7,4 @@ send2trash
|
||||
waitress>=2.0.0
|
||||
psutil; sys.platform == "win32"
|
||||
pywin32; sys.platform == "win32"
|
||||
winrt; sys.platform == "win32"
|
||||
winsdk; sys.platform == "win32"
|
||||
|
@ -1 +1,3 @@
|
||||
pywin32
|
||||
winsdk
|
||||
|
||||
|
@ -14,3 +14,16 @@ pywin32==305 \
|
||||
--hash=sha256:9dd98384da775afa009bc04863426cb30596fd78c6f8e4e2e5bbf4edf8029504 \
|
||||
--hash=sha256:a55db448124d1c1484df22fa8bbcbc45c64da5e6eae74ab095b9ea62e6d00496
|
||||
# via -r requirements.win.in
|
||||
winsdk==1.0.0b7 \
|
||||
--hash=sha256:0e3a07cbd1d63f046e11e87144a5d7fc592a0baf7518ed90c40d29efe1dd4708 \
|
||||
--hash=sha256:141f40a6a7819df0fe9511b7d31bebc7119cb4c643ee695e7069cea198868efc \
|
||||
--hash=sha256:51875edb889a94dbe24357277f56270eae0e3a1436acf5e596d36c95aef09977 \
|
||||
--hash=sha256:873ef6fd47f78830ccbe4fc47482056b881c6ae05eaca5ba5ddabef6fe32582e \
|
||||
--hash=sha256:955421aace349ef26cfc8dccbfaa716917a0f3c5043aaef3b1534ad7efd86bf6 \
|
||||
--hash=sha256:a49606148b3ecac1860e7fc17d31d7149925c0387c41e85be1c655572a3b24f6 \
|
||||
--hash=sha256:a653eca5a0e83f8e35f2d706a67160705ba7ac3200d29684e0821a61b00ab66c \
|
||||
--hash=sha256:b90367c2fda2f649cf2fa16dd49511d7c74db11fc0abac4a46e773d97fb340e2 \
|
||||
--hash=sha256:ccff00afe526a77f88b7f32e3a3924f3b7c83f2ea168665af449d2c0acfb4e4f \
|
||||
--hash=sha256:d2b389c3252774e5cef432e0236e7880fff1bff1a237724f9ed1ae0fc2635352 \
|
||||
--hash=sha256:e059d13117e6c57e95c6e0b3a6b67b432769b5301b89676a20d76452afdd213b
|
||||
# via -r requirements.win.in
|
||||
|
1
python/update_win_deps.bat
Normal file
1
python/update_win_deps.bat
Normal file
@ -0,0 +1 @@
|
||||
..\out\pyenv\scripts\pip-compile --resolver=backtracking --allow-unsafe --no-header --strip-extras --generate-hashes requirements.win.in
|
@ -552,12 +552,12 @@ if is_win:
|
||||
tmppath = os.path.join(tmpdir(), "tts.wav")
|
||||
|
||||
def import_voices(self) -> None:
|
||||
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||
import winsdk.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||
|
||||
try:
|
||||
self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices()
|
||||
except Exception as e:
|
||||
print("winrt tts voices unavailable:", e)
|
||||
print("winsdk tts voices unavailable:", e)
|
||||
self.voice_list = []
|
||||
|
||||
def get_available_voices(self) -> list[TTSVoice]:
|
||||
@ -600,8 +600,8 @@ if is_win:
|
||||
cb()
|
||||
|
||||
async def speakText(self, tag: TTSTag, voice_id: Any) -> None:
|
||||
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||
import winrt.windows.storage.streams as streams # type: ignore
|
||||
import winsdk.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||
import winsdk.windows.storage.streams as streams # type: ignore
|
||||
|
||||
synthesizer = speechsynthesis.SpeechSynthesizer()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user