Adjust the patch

OBS-URL: https://build.opensuse.org/package/show/Education/epy?expand=0&rev=8
This commit is contained in:
Matej Cepl 2021-12-20 19:48:12 +00:00 committed by Git OBS Bridge
parent de49d8830d
commit e1a078109f

View File

@ -7,15 +7,13 @@ Unfortunately, the language setting is gone again.
Fixes #42 Fixes #42
--- ---
README.md | 10 ++++------ README.md | 10 ++++------
epy.py | 22 +++++++++------------- epy.py | 22 +++++++++-------------
2 files changed, 13 insertions(+), 19 deletions(-) 2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/README.md b/README.md
index d434d79..a3950c3 100644
--- a/README.md --- a/README.md
+++ b/README.md +++ b/README.md
@@ -87,21 +87,19 @@ But you can enable it by setting `MouseSupport` to `true` in config file. @@ -93,21 +93,19 @@ But you can enable it by setting `MouseS
To get Text-to-Speech (TTS) support, you need to install these external dependencies: To get Text-to-Speech (TTS) support, you need to install these external dependencies:
@ -41,11 +39,9 @@ index d434d79..a3950c3 100644
## Double Spread ## Double Spread
diff --git a/epy.py b/epy.py
index 6b131b7..6c9510b 100755
--- a/epy.py --- a/epy.py
+++ b/epy.py +++ b/epy.py
@@ -1881,7 +1881,7 @@ class Reader: @@ -1871,7 +1871,7 @@ class Reader:
self.jump_list: Mapping[str, ReadingState] = dict() self.jump_list: Mapping[str, ReadingState] = dict()
# TTS speaker utils # TTS speaker utils
@ -54,22 +50,22 @@ index 6b131b7..6c9510b 100755
self.is_speaking: bool = False self.is_speaking: bool = False
# multi process & progress percentage # multi process & progress percentage
@@ -2344,19 +2344,16 @@ class Reader: @@ -2334,19 +2334,16 @@ class Reader:
self.screen.refresh() self.screen.refresh()
self.screen.timeout(1) self.screen.timeout(1)
try: try:
- _, path = tempfile.mkstemp(suffix=".wav") - _, path = tempfile.mkstemp(suffix=".wav")
- subprocess.call( - subprocess.call(
- ["pico2wave", f"--lang={self.setting.TTSLang}", "-w", path, text], - ["pico2wave", "-w", path, text],
+ spk = subprocess.Popen( - stdout=subprocess.DEVNULL,
+ ["mimic"], text=True,
+ stdin=subprocess.PIPE,
stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL, - stderr=subprocess.DEVNULL,
- ) - )
- speaker = subprocess.Popen( - speaker = subprocess.Popen(
- ["play", path, "tempo", str(self.setting.TTSSpeed)], - ["play", path, "tempo", str(self.setting.TTSSpeed)],
- stdout=subprocess.DEVNULL, + spk = subprocess.Popen(
+ ["mimic"], text=True,
+ stdin=subprocess.PIPE,
stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL, - stderr=subprocess.DEVNULL,
+ stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT,
) )
@ -81,7 +77,7 @@ index 6b131b7..6c9510b 100755
k = self.keymap.PageDown[0] k = self.keymap.PageDown[0]
break break
tmp = self.screen.getch() tmp = self.screen.getch()
@@ -2383,12 +2380,11 @@ class Reader: @@ -2373,12 +2370,11 @@ class Reader:
+ self.keymap.ScrollDown + self.keymap.ScrollDown
+ (curses.KEY_RESIZE,) + (curses.KEY_RESIZE,)
): ):
@ -95,6 +91,3 @@ index 6b131b7..6c9510b 100755
if k in self.keymap.Quit: if k in self.keymap.Quit:
self.is_speaking = False self.is_speaking = False
--
2.34.1