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 std::string & audio_role) {
266 const auto request_sequence_path = optional_path_arg(argc, argv, "--request-sequence");
267 const auto batch_text_file = optional_path_arg(argc, argv, "--batch-text-file");
268 const auto batch_text_dir = optional_path_arg(argc, argv, "--batch-text-dir");
269 const auto batch_audio_dir = optional_path_arg(argc, argv, "--batch-audio-dir");
270 const int count =
271 (request_sequence_path.has_value() ? 1 : 0) +
272 (batch_text_file.has_value() ? 1 : 0) +
273 (batch_text_dir.has_value() ? 1 : 0) +
274 (batch_audio_dir.has_value() ? 1 : 0);
275 if (count == 0) {
276 return minitts::app::AppBatchRequest{};
277 }
278 if (count > 1) {
279 throw std::runtime_error(
280 "choose only one of --request-sequence, --batch-text-file, --batch-text-dir, or --batch-audio-dir");
281 }
282 if (request_sequence_path.has_value()) {
283 return build_request_sequence_from_json(*request_sequence_path);
284 }
285 if (batch_text_file.has_value()) {
286 return build_text_file_batch(
287 *batch_text_file,
288 base_request,
289 find_arg(argc, argv, "--language").value_or(""));
290 }
291 if (batch_text_dir.has_value()) {
292 return build_text_dir_batch(
293 *batch_text_dir,
294 base_request,
295 find_arg(argc, argv, "--language").value_or(""));
296 }
297 return build_audio_dir_batch(*batch_audio_dir, base_request, audio_role);
298}
299
300} // 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