From 5690f374771d17bbec978d39dc9ddd14de8ecb7b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Aug 2025 22:39:08 +0530 Subject: [PATCH] ... --- src/calibre/gui2/tts/piper.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/tts/piper.py b/src/calibre/gui2/tts/piper.py index 2b0c386fb0..7df16ec515 100644 --- a/src/calibre/gui2/tts/piper.py +++ b/src/calibre/gui2/tts/piper.py @@ -393,12 +393,10 @@ class Piper(TTSBackend): self._set_state(QTextToSpeech.State.Ready) def _queue_current_utterance(self) -> None: - if self._utterances_being_synthesized: - u = self._utterances_being_synthesized[0] - if not u.started: - global_piper_instance().synthesize(u.id, u.sentence) - u.started = True - debug(f'Utterance {u.id} synthesis queued') + if self._utterances_being_synthesized and not (u := self._utterances_being_synthesized[0]).started: + global_piper_instance().synthesize(u.id, u.sentence) + u.started = True + debug(f'Utterance {u.id} synthesis queued') def audio_sink_state_changed(self, state: QAudio.State) -> None: self._update_status()