mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 21:50:28 +02:00
Added informative messages and improved error handling for ffmpeg
This commit is contained in:
+11
-7
@@ -634,14 +634,18 @@ class ConversionThread(QThread):
|
|||||||
"-map_chapters", "1",
|
"-map_chapters", "1",
|
||||||
out_path_m4b
|
out_path_m4b
|
||||||
]
|
]
|
||||||
try:
|
|
||||||
result = subprocess.run(ffmpeg_cmd, capture_output=True, text=True)
|
self.log_updated.emit("Adding chapters to the audio file...\n")
|
||||||
# TODO Check for errors in the ffmpeg command
|
result = subprocess.run(ffmpeg_cmd, capture_output=True, text=True)
|
||||||
except subprocess.CalledProcessError as e:
|
# Check for errors in the ffmpeg command
|
||||||
self.log_updated.emit(
|
if result.returncode != 0:
|
||||||
(f"FFmpeg error: {e.stderr}", "red")
|
self.log_updated.emit((f"FFmpeg error: {result.stderr}", "red"))
|
||||||
)
|
# Log error but continue with original file
|
||||||
|
self.log_updated.emit(("Falling back to the original audio file without chapters\n", "orange"))
|
||||||
return out_path
|
return out_path
|
||||||
|
else:
|
||||||
|
self.log_updated.emit(("Successfully added chapters to the audio file.\n", "green"))
|
||||||
|
|
||||||
# delete the chapters path and original (wav) file
|
# delete the chapters path and original (wav) file
|
||||||
os.remove(chapters_info_path)
|
os.remove(chapters_info_path)
|
||||||
os.remove(out_path)
|
os.remove(out_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user