diff --git a/mimic.patch b/mimic.patch index eeef537..8917dcb 100644 --- a/mimic.patch +++ b/mimic.patch @@ -7,15 +7,13 @@ Unfortunately, the language setting is gone again. Fixes #42 --- - README.md | 10 ++++------ - epy.py | 22 +++++++++------------- + README.md | 10 ++++------ + epy.py | 22 +++++++++------------- 2 files changed, 13 insertions(+), 19 deletions(-) -diff --git a/README.md b/README.md -index d434d79..a3950c3 100644 --- a/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: @@ -41,11 +39,9 @@ index d434d79..a3950c3 100644 ## Double Spread -diff --git a/epy.py b/epy.py -index 6b131b7..6c9510b 100755 --- a/epy.py +++ b/epy.py -@@ -1881,7 +1881,7 @@ class Reader: +@@ -1871,7 +1871,7 @@ class Reader: self.jump_list: Mapping[str, ReadingState] = dict() # TTS speaker utils @@ -54,22 +50,22 @@ index 6b131b7..6c9510b 100755 self.is_speaking: bool = False # multi process & progress percentage -@@ -2344,19 +2344,16 @@ class Reader: +@@ -2334,19 +2334,16 @@ class Reader: self.screen.refresh() self.screen.timeout(1) try: - _, path = tempfile.mkstemp(suffix=".wav") - subprocess.call( -- ["pico2wave", f"--lang={self.setting.TTSLang}", "-w", path, text], -+ spk = subprocess.Popen( -+ ["mimic"], text=True, -+ stdin=subprocess.PIPE, - stdout=subprocess.DEVNULL, +- ["pico2wave", "-w", path, text], +- stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - ) - speaker = subprocess.Popen( - ["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.STDOUT, ) @@ -81,7 +77,7 @@ index 6b131b7..6c9510b 100755 k = self.keymap.PageDown[0] break tmp = self.screen.getch() -@@ -2383,12 +2380,11 @@ class Reader: +@@ -2373,12 +2370,11 @@ class Reader: + self.keymap.ScrollDown + (curses.KEY_RESIZE,) ): @@ -95,6 +91,3 @@ index 6b131b7..6c9510b 100755 if k in self.keymap.Quit: self.is_speaking = False --- -2.34.1 -