aboutsummaryrefslogtreecommitdiff
path: root/app/converter
diff options
context:
space:
mode:
Diffstat (limited to 'app/converter')
-rw-r--r--app/converter/audio.py3
-rw-r--r--app/converter/clients/faster.py5
-rw-r--r--app/converter/config.py2
-rw-r--r--app/converter/extractors.py5
4 files changed, 6 insertions, 9 deletions
diff --git a/app/converter/audio.py b/app/converter/audio.py
index 90ce5ca..def4395 100644
--- a/app/converter/audio.py
+++ b/app/converter/audio.py
@@ -564,7 +564,8 @@ def combine_chapters_to_m4b(chapter_files: List[Path], titles: List[str],
chapters = []
start_ms = 0
with open(concat_list, "w", encoding="utf-8") as list_file:
- for chapter_file, title in zip(chapter_files, titles):
+ for chapter_file, title in zip(chapter_files, titles,
+ strict=False):
list_file.write(f"file '{_concat_escape(str(chapter_file))}'\n")
duration_ms = probe_duration_ms(chapter_file)
end_ms = start_ms + duration_ms
diff --git a/app/converter/clients/faster.py b/app/converter/clients/faster.py
index df98546..f0874e0 100644
--- a/app/converter/clients/faster.py
+++ b/app/converter/clients/faster.py
@@ -102,9 +102,8 @@ class FasterTTSClient(BaseTTSClient):
pcm_parts: List[bytes] = []
with self._chunk_heartbeat(chunk_num):
- for sub_num, sub_text in enumerate(sub_chunks, 1):
- pcm = self._request_pcm(sub_text)
- pcm_parts.append(pcm)
+ for sub_text in sub_chunks:
+ pcm_parts.append(self._request_pcm(sub_text))
output_path = self._chunk_path(chunk_num, ".wav")
with wave.open(str(output_path), "wb") as wav_file:
diff --git a/app/converter/config.py b/app/converter/config.py
index 3727885..9b09e7a 100644
--- a/app/converter/config.py
+++ b/app/converter/config.py
@@ -58,7 +58,7 @@ FASTER_API_URL = "http://127.0.0.1:8000" # faster-qwen3-tts server (Base mo
FASTER_REMOTE_URL = "http://127.0.0.1:8000" # externally-run faster-qwen3-tts server ("" disables probing)
# Default voice if no --voice is passed
-FASTER_VOICE = "default"
+FASTER_VOICE = "narrator"
###############################################################################
# BACKEND 3: audio.cpp options #
diff --git a/app/converter/extractors.py b/app/converter/extractors.py
index a564333..f05d451 100644
--- a/app/converter/extractors.py
+++ b/app/converter/extractors.py
@@ -79,8 +79,7 @@ def extract_book(file_path: Path) -> Book:
def _epub_metadata(file_path: Path) -> tuple:
"""Return (title, author) from an EPUB's Dublin Core metadata."""
try:
- import ebooklib
- from ebooklib import epub
+ from ebooklib import epub # raises ImportError when unavailable
book = epub.read_epub(str(file_path))
title = _first_dc_value(book.get_metadata("DC", "title"))
@@ -116,8 +115,6 @@ def _first_dc_value(entries) -> str:
def _extract_epub_chapters(file_path: Path) -> List[Section]:
"""Return one Section per EPUB spine document (chapter), in reading order."""
- import ebooklib
-
book = None
for method in (_read_epub_ebooklib, _read_epub_zipfile, _read_epub_manual):
try: