fix: lambda
This commit is contained in:
@@ -28,12 +28,12 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
from . import tts_aedocw, tts_edge, tts_generic
|
from . import tts_aedocw, tts_generic
|
||||||
|
|
||||||
backend = {
|
backend = {
|
||||||
# keys are the backend names, values are the corresponding TTS classes
|
# keys are the backend names, values are the corresponding TTS classes
|
||||||
"default": tts_generic.GenericTTSBackend,
|
"default": tts_generic.GenericTTSBackend,
|
||||||
"edge": tts_edge.TTSEdge,
|
"edge": tts_aedocw.TTSEdge,
|
||||||
# aedocw-backed implementations — these expect the corresponding
|
# aedocw-backed implementations — these expect the corresponding
|
||||||
# package "console scripts"/entrypoints to be available in the
|
# package "console scripts"/entrypoints to be available in the
|
||||||
# environment (or an explicit backend_cmd to be provided).
|
# environment (or an explicit backend_cmd to be provided).
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ class GenericTTSBackend:
|
|||||||
".ogg": "ogg",
|
".ogg": "ogg",
|
||||||
}
|
}
|
||||||
|
|
||||||
_INPUT_FLAG_MAP = lambda x: [
|
_INPUT_FLAG_MAP = lambda self, is_dir, path: [
|
||||||
"--input-dir", x] if x else ["--input-file", x]
|
"--input-dir", path] if is_dir else ["--input-file", path]
|
||||||
|
|
||||||
_OUTPUT_FLAG_MAP = lambda x: [
|
_OUTPUT_FLAG_MAP = lambda self, is_dir, path: [
|
||||||
"--output-dir", x] if x else ["--output-file", x]
|
"--output-dir", path] if is_dir else ["--output-file", path]
|
||||||
|
|
||||||
def __init__(self,**kwargs):
|
def __init__(self,**kwargs):
|
||||||
for k,v in kwargs.items():
|
for k,v in kwargs.items():
|
||||||
@@ -79,11 +79,13 @@ class GenericTTSBackend:
|
|||||||
|
|
||||||
|
|
||||||
def gen_input_flag(self, input_path: Path) -> str:
|
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:
|
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]:
|
def _build_command(self, input_source: PathLike, output_dest: PathLike) -> list[str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user