working backend
This commit is contained in:
@@ -57,6 +57,7 @@ def main(args=None):
|
||||
p.add_argument("-o", "--output", help="Output audio file", required=True)
|
||||
p.add_argument("-l", "--language", help="Language to use for TTS")
|
||||
p.add_argument("-v", "--voice", help="Voice to use for TTS")
|
||||
p.add_argument("-r", "--replace", action="append", nargs=2, help="Replace text in the intermediate output. Specify pairs of old_text new_text. Can be used multiple times.")
|
||||
p.add_argument(
|
||||
"-b",
|
||||
"--backend",
|
||||
@@ -65,6 +66,8 @@ def main(args=None):
|
||||
choices=backend.keys(),
|
||||
)
|
||||
args = p.parse_args(args or sys.argv[1:])
|
||||
setattr(args, 'replace_map',
|
||||
{old: new for old, new in args.replace} if args.replace else None)
|
||||
print(
|
||||
f"Converting {args.input} to {args.output} "
|
||||
f"using {args.backend} backend "
|
||||
@@ -72,20 +75,12 @@ def main(args=None):
|
||||
f"{k}={v}" for k, v in vars(args).items()
|
||||
if k not in ("input", "output", "backend") and v is not None)
|
||||
)
|
||||
|
||||
#print(args.replace_map)
|
||||
|
||||
input_path = Path(args.input).resolve()
|
||||
if not input_path.exists():
|
||||
raise FileNotFoundError(f"Input file {input_path} does not exist.")
|
||||
output_path = Path(args.output).resolve()
|
||||
if not output_path.parent.exists():
|
||||
os.makedirs(output_path.parent, exist_ok=True)
|
||||
|
||||
backend_cls = backend[args.backend]
|
||||
backend_instance = backend_cls(
|
||||
backend_cmd=None,
|
||||
)
|
||||
backend_instance.run(
|
||||
input_path, output_path,
|
||||
|
||||
backend[args.backend]().run(
|
||||
args.input, args.output,
|
||||
**vars(args),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user