MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / build_batch_request_from_cli

Function build_batch_request_from_cli

app/cli/batch.cpp:261–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261minitts::app::AppBatchRequest build_batch_request_from_cli(
262 int argc,
263 char ** argv,
264 const engine::runtime::TaskRequest & base_request) {
265 const auto request_sequence_path = optional_path_arg(argc, argv, "--request-sequence");
266 const auto batch_text_file = optional_path_arg(argc, argv, "--batch-text-file");
267 const auto batch_text_dir = optional_path_arg(argc, argv, "--batch-text-dir");
268 const auto batch_audio_dir = optional_path_arg(argc, argv, "--batch-audio-dir");
269 const int count =
270 (request_sequence_path.has_value() ? 1 : 0) +
271 (batch_text_file.has_value() ? 1 : 0) +
272 (batch_text_dir.has_value() ? 1 : 0) +
273 (batch_audio_dir.has_value() ? 1 : 0);
274 if (count == 0) {
275 return minitts::app::AppBatchRequest{};
276 }
277 if (count > 1) {
278 throw std::runtime_error(
279 "choose only one of --request-sequence, --batch-text-file, --batch-text-dir, or --batch-audio-dir");
280 }
281 if (request_sequence_path.has_value()) {
282 return build_request_sequence_from_json(*request_sequence_path);
283 }
284 if (batch_text_file.has_value()) {
285 return build_text_file_batch(
286 *batch_text_file,
287 base_request,
288 find_arg(argc, argv, "--language").value_or(""));
289 }
290 if (batch_text_dir.has_value()) {
291 return build_text_dir_batch(
292 *batch_text_dir,
293 base_request,
294 find_arg(argc, argv, "--language").value_or(""));
295 }
296 return build_audio_dir_batch(
297 *batch_audio_dir,
298 base_request,
299 find_arg(argc, argv, "--batch-audio-role").value_or("audio"));
300}
301
302} // namespace minitts::cli

Callers 1

mainFunction · 0.85

Calls 6

optional_path_argFunction · 0.85
build_text_file_batchFunction · 0.85
build_text_dir_batchFunction · 0.85
build_audio_dir_batchFunction · 0.85
find_argFunction · 0.70

Tested by

no test coverage detected