comparison runner/main.cpp @ 144:b3d73c08b6ce

Add descriptions for writers; add housekeeping options to Sonic Annotator to list writers and formats
author Chris Cannam
date Mon, 13 Oct 2014 14:44:51 +0100
parents 6b62bae0af33
children 859d8ec60e06
comparison
equal deleted inserted replaced
143:ad425b9096bd 144:b3d73c08b6ce
309 cerr << endl; 309 cerr << endl;
310 cerr << " -f, --force Continue with subsequent files following an error." << endl; 310 cerr << " -f, --force Continue with subsequent files following an error." << endl;
311 cerr << endl; 311 cerr << endl;
312 cerr << "Housekeeping options:" << endl; 312 cerr << "Housekeeping options:" << endl;
313 cerr << endl; 313 cerr << endl;
314 cerr << " -l, --list List all known transform ids to standard output." << endl; 314 cerr << " -l, --list List available transform ids to standard output." << endl;
315 cerr << " --list-writers List supported writer types to standard output." << endl;
316 cerr << " --list-formats List supported input audio formats to standard output." << endl;
315 cerr << endl; 317 cerr << endl;
316 cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl; 318 cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl;
317 cerr << " and write it to standard output." << endl; 319 cerr << " and write it to standard output." << endl;
318 cerr << endl; 320 cerr << endl;
319 cerr << " -v, --version Show the version number and exit." << endl; 321 cerr << " -v, --version Show the version number and exit." << endl;
336 if (!w) { 338 if (!w) {
337 cerr << " (Internal error: failed to create writer of known type \"" 339 cerr << " (Internal error: failed to create writer of known type \""
338 << writer << "\")" << endl; 340 << writer << "\")" << endl;
339 return; 341 return;
340 } 342 }
343 cerr << "Feature writer \"" << writer << "\":" << endl << endl;
344 cerr << " " << wrap(w->getDescription().c_str(), 76, 2) << endl << endl;
341 cerr << "Additional options for writer type \"" << writer << "\":" << endl; 345 cerr << "Additional options for writer type \"" << writer << "\":" << endl;
342 cerr << endl; 346 cerr << endl;
343 FeatureWriter::ParameterList params = w->getSupportedParameters(); 347 FeatureWriter::ParameterList params = w->getSupportedParameters();
344 delete w; 348 delete w;
345 if (params.empty()) { 349 if (params.empty()) {
346 cerr << "(No special options available for this writer)" << endl; 350 cerr << " No additional options are available for this writer." << endl << endl;
347 return; 351 return;
348 } 352 }
349 for (FeatureWriter::ParameterList::const_iterator j = params.begin(); 353 for (FeatureWriter::ParameterList::const_iterator j = params.begin();
350 j != params.end(); ++j) { 354 j != params.end(); ++j) {
351 cerr << " --" << writer << "-" << j->name << " "; 355 cerr << " --" << writer << "-" << j->name << " ";
466 bool force = false; 470 bool force = false;
467 bool multiplex = false; 471 bool multiplex = false;
468 bool recursive = false; 472 bool recursive = false;
469 bool normalise = false; 473 bool normalise = false;
470 bool list = false; 474 bool list = false;
475 bool listWriters = false;
476 bool listFormats = false;
471 bool summaryOnly = false; 477 bool summaryOnly = false;
472 QString skeletonFor = ""; 478 QString skeletonFor = "";
473 QString minVersion = ""; 479 QString minVersion = "";
474 QString myname = args[0]; 480 QString myname = args[0];
475 myname = QFileInfo(myname).baseName(); 481 myname = QFileInfo(myname).baseName();
604 normalise = true; 610 normalise = true;
605 continue; 611 continue;
606 } else if (arg == "-f" || arg == "--force") { 612 } else if (arg == "-f" || arg == "--force") {
607 force = true; 613 force = true;
608 continue; 614 continue;
615 } else if (arg == "--list-writers") {
616 listWriters = true;
617 continue;
618 } else if (arg == "--list-formats") {
619 listFormats = true;
620 continue;
609 } else if (arg == "-l" || arg == "--list") { 621 } else if (arg == "-l" || arg == "--list") {
610 list = true; 622 list = true;
611 continue; 623 continue;
612 } else if (arg == "--minversion") { 624 } else if (arg == "--minversion") {
613 if (last || args[i+1].startsWith("-")) { 625 if (last || args[i+1].startsWith("-")) {
632 } else { 644 } else {
633 otherArgs.push_back(args[i]); 645 otherArgs.push_back(args[i]);
634 } 646 }
635 } 647 }
636 648
649 if (list) {
650 if (!requestedWriterTags.empty() || skeletonFor != "") {
651 cerr << helpStr << endl;
652 exit(2);
653 }
654 listTransforms();
655 exit(0);
656 }
657 if (listWriters) {
658 if (!requestedWriterTags.empty() || skeletonFor != "") {
659 cerr << helpStr << endl;
660 exit(2);
661 }
662 set<string> writers = FeatureWriterFactory::getWriterTags();
663 bool first = true;
664 for (set<string>::const_iterator i = writers.begin();
665 i != writers.end(); ++i) {
666 if (!first) cout << " ";
667 cout << *i;
668 first = false;
669 }
670 cout << endl;
671 exit(0);
672 }
673 if (listFormats) {
674 if (!requestedWriterTags.empty() || skeletonFor != "") {
675 cerr << helpStr << endl;
676 exit(2);
677 }
678 QString extensions = AudioFileReaderFactory::getKnownExtensions();
679 QStringList extlist = extensions.split(" ", QString::SkipEmptyParts);
680 bool first = true;
681 foreach (QString s, extlist) {
682 if (!first) cout << " ";
683 s.replace("*.", "");
684 cout << s;
685 first = false;
686 }
687 cout << endl;
688 exit(0);
689 }
637 if (list) { 690 if (list) {
638 if (!requestedWriterTags.empty() || skeletonFor != "") { 691 if (!requestedWriterTags.empty() || skeletonFor != "") {
639 cerr << helpStr << endl; 692 cerr << helpStr << endl;
640 exit(2); 693 exit(2);
641 } 694 }