fix: lambda
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user