This commit is contained in:
2026-08-06 18:20:54 -03:00
parent a2adafe9e8
commit f2c66a1876
9 changed files with 39 additions and 12 deletions
+25 -6
View File
@@ -1,25 +1,44 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2025-2026 Renato Xavier da Silveira Rosa
# Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# See [LICENSE](./LICENSE) or [BSD-3-Clause-Clear](https://spdx.org/licenses/BSD-3-Clause-Clear.html)
"""Command-line interface for converting EPUB to audio using TTS.
This module provides a command-line interface (CLI) for converting EPUB files to audio using text-to-speech (TTS) backends. It allows users to specify the input EPUB file, output audio file, language, voice, and backend to use for TTS conversion.
usage: epub-tts [-h] [--version] -i INPUT -o OUTPUT [-l LANGUAGE]
[-v VOICE] [-b {default,edge,epub2tts,epub2tts-edge,epub2tts-chatterbox,epub2tts-kokoro}]
optional arguments:
-h, --help show this help message and exit
--version Show version and exit
-i INPUT, --input INPUT
Input EPUB file
-o OUTPUT, --output OUTPUT
Output audio file
-l LANGUAGE, --language LANGUAGE
Language to use for TTS
-v VOICE, --voice Voice to use for TTS
-b {default,edge,epub2tts,epub2tts-edge,epub2tts-chatterbox,epub2tts-kokoro}, --backend {default,edge,epub2tts,epub2tts-edge,epub2tts-chatterbox,epub2tts-kokoro}
Backend to use for TTS
"""
import sys
from argparse import ArgumentParser
from epub_tts import aedocw_backend, tts_backend, tts_edge
from . import tts_aedocw, tts_edge, tts_generic
backend = {
# keys are the backend names, values are the corresponding TTS classes
"default": tts_backend.GenericTTSBackend,
"default": tts_generic.GenericTTSBackend,
"edge": tts_edge.TTSEdge,
# aedocw-backed implementations — these expect the corresponding
# package "console scripts"/entrypoints to be available in the
# environment (or an explicit backend_cmd to be provided).
"epub2tts": aedocw_backend.AedocwEpub2TTS,
"epub2tts-edge": aedocw_backend.AedocwEpub2TTSEdge,
"epub2tts-chatterbox": aedocw_backend.AedocwChatterbox,
"epub2tts-kokoro": aedocw_backend.AedocwKokoro,
"epub2tts": tts_aedocw.AedocwEpub2TTS,
"epub2tts-edge": tts_aedocw.AedocwEpub2TTSEdge,
"epub2tts-chatterbox": tts_aedocw.AedocwChatterbox,
"epub2tts-kokoro": tts_aedocw.AedocwKokoro,
}