aboutsummaryrefslogtreecommitdiff
path: root/audiobook.py
diff options
context:
space:
mode:
Diffstat (limited to 'audiobook.py')
-rwxr-xr-xaudiobook.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/audiobook.py b/audiobook.py
index b881a12..0b3734c 100755
--- a/audiobook.py
+++ b/audiobook.py
@@ -227,6 +227,26 @@ Examples:
else:
voice_mode = VOICE_MODE_CLONE if args.clone else VOICE_MODE_CUSTOM
+ # Ask every overwrite question up front, before spending time connecting
+ # to a TTS server: a user who declines (or has nothing to convert) never
+ # waits on a slow server handshake. Nothing in this step needs the server.
+ book_files, planned = AudiobookConverter.preflight_overwrites(
+ backend=args.backend,
+ voice=args.voice,
+ voice_mode=voice_mode,
+ voice_clone_ref_audio=args.clone,
+ output_format=args.format,
+ )
+
+ if not book_files:
+ print("[INFO] Nothing to convert. Add a .txt, .pdf, or .epub file "
+ "to the input folder and run again.")
+ sys.exit(0)
+
+ if not planned:
+ print("[INFO] Nothing to convert (all books skipped)")
+ sys.exit(0)
+
try:
converter = AudiobookConverter(
voice_mode=voice_mode,
@@ -242,6 +262,8 @@ Examples:
debug=args.debug,
chunk=args.chunk,
)
+ converter._book_files = book_files
+ converter._planned = planned
ok = converter.run()
except KeyboardInterrupt:
print("\n[WARNING] Shutdown requested by user")