From 7fff2f154cbb2b5d50c6ef3d6c8a11b7e2a9d459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deniz=20=C5=9Eafak?= Date: Sat, 10 May 2025 00:44:26 +0300 Subject: [PATCH] Fix [Errno 32] in Linux --- CHANGELOG.md | 2 +- abogen/conversion.py | 2 -- abogen/gui.py | 4 +++- abogen/utils.py | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74c40d5..c321ad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Added `Save in a project folder with metadata` option in the book handler, allowing users to save the converted items in a project folder with available metadata files. Useful if you want to work with the converted files in the future, issue mentioned by @Darthagnon in #15 - Added `Go to folder` button in input box, allowing users to open the folder containing the converted file. - Added `.opus` as output format for generated audio files, which is a more efficient format for audio files. -- Added `Create desktop shortcut & install` option to Linux version, allowing users to create a shortcut and install +- Added `Create desktop shortcut and install` option to Linux version, allowing users to create a shortcut and install - Added "Playing..." indicator for "Preview" button in the voice mixer. # v1.0.6 diff --git a/abogen/conversion.py b/abogen/conversion.py index ae12af6..d1ee171 100644 --- a/abogen/conversion.py +++ b/abogen/conversion.py @@ -603,7 +603,6 @@ class ConversionThread(QThread): opus_out_path, ] try: - print(f"Executing FFMPEG for Opus: {' '.join(ffmpeg_cmd_opus)}") process = create_process(ffmpeg_cmd_opus, stdin=subprocess.PIPE, text=False) # Ensure binary stdin process.stdin.write(audio_data_np.astype("float32").tobytes()) process.stdin.close() @@ -713,7 +712,6 @@ class ConversionThread(QThread): ] self.log_updated.emit(f"Generating audio with chapters...\n") - print(f"Executing FFMPEG for M4B: {' '.join(ffmpeg_cmd)}") process = create_process(ffmpeg_cmd, stdin=subprocess.PIPE, text=False) # Ensure binary stdin process.stdin.write(audio_data_np.astype("float32").tobytes()) diff --git a/abogen/gui.py b/abogen/gui.py index e386ce4..ea08a79 100644 --- a/abogen/gui.py +++ b/abogen/gui.py @@ -485,6 +485,7 @@ class TextboxDialog(QDialog): cursor.insertText("<>") self.text_edit.setTextCursor(cursor) self.update_char_count() + self.text_edit.setFocus() class abogen(QWidget): @@ -1808,7 +1809,7 @@ class abogen(QWidget): # Add shortcut to desktop (Windows or Linux) if platform.system() == "Windows" or platform.system() == "Linux": # Use extended label on Linux - label = "Create desktop shortcut & install" if platform.system() == "Linux" else "Create desktop shortcut" + label = "Create desktop shortcut and install" if platform.system() == "Linux" else "Create desktop shortcut" add_shortcut_action = QAction(label, self) add_shortcut_action.triggered.connect(self.add_shortcut_to_desktop) menu.addAction(add_shortcut_action) @@ -2291,3 +2292,4 @@ Categories=AudioVideo;Audio;Utility; "Setting Saved", f"Maximum words per subtitle set to {value}.", ) + diff --git a/abogen/utils.py b/abogen/utils.py index 9282588..63e4ffe 100644 --- a/abogen/utils.py +++ b/abogen/utils.py @@ -134,6 +134,7 @@ def create_process(cmd, stdin=None, text=True): # Configure for binary I/O kwargs["text"] = False # For binary mode, 'encoding' and 'errors' arguments must not be passed to Popen + kwargs["bufsize"] = 0 # Use unbuffered mode for binary data if stdin is not None: kwargs["stdin"] = stdin