From 3553426a723446398431bbf4fc75cd07d4d81747 Mon Sep 17 00:00:00 2001 From: RenatoXSR Date: Fri, 7 Aug 2026 00:13:00 -0300 Subject: [PATCH] fix: lambda --- src/epub_tts/__main__.py | 4 ++-- src/epub_tts/tts_generic.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/epub_tts/__main__.py b/src/epub_tts/__main__.py index 1f2c00f..f9ac1d1 100644 --- a/src/epub_tts/__main__.py +++ b/src/epub_tts/__main__.py @@ -28,12 +28,12 @@ import sys from pathlib import Path from argparse import ArgumentParser -from . import tts_aedocw, tts_edge, tts_generic +from . import tts_aedocw, tts_generic backend = { # keys are the backend names, values are the corresponding TTS classes "default": tts_generic.GenericTTSBackend, - "edge": tts_edge.TTSEdge, + "edge": tts_aedocw.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). diff --git a/src/epub_tts/tts_generic.py b/src/epub_tts/tts_generic.py index a6ca797..248aa5f 100644 --- a/src/epub_tts/tts_generic.py +++ b/src/epub_tts/tts_generic.py @@ -60,11 +60,11 @@ class GenericTTSBackend: ".ogg": "ogg", } - _INPUT_FLAG_MAP = lambda x: [ - "--input-dir", x] if x else ["--input-file", x] + _INPUT_FLAG_MAP = lambda self, is_dir, path: [ + "--input-dir", path] if is_dir else ["--input-file", path] - _OUTPUT_FLAG_MAP = lambda x: [ - "--output-dir", x] if x else ["--output-file", x] + _OUTPUT_FLAG_MAP = lambda self, is_dir, path: [ + "--output-dir", path] if is_dir else ["--output-file", path] def __init__(self,**kwargs): for k,v in kwargs.items(): @@ -79,11 +79,13 @@ class GenericTTSBackend: def gen_input_flag(self, input_path: Path) -> str: - return self._INPUT_FLAG_MAP(self._normalize_path(input_path).is_dir()) + return self._INPUT_FLAG_MAP( + self._normalize_path(input_path).is_dir(), input_path) def gen_output_flag(self, output_path: Path) -> str: - return self._OUTPUT_FLAG_MAP(self._normalize_path(output_path).is_dir()) + return self._OUTPUT_FLAG_MAP( + self._normalize_path(output_path).is_dir(), output_path) def _build_command(self, input_source: PathLike, output_dest: PathLike) -> list[str]: