Mercurial > hg > sonic-annotator
changeset 125:685e5cf3cb1d
Adjustments to help text; test file:// URLs
author | Chris Cannam |
---|---|
date | Thu, 09 Oct 2014 10:41:40 +0100 |
parents | c72889726a98 |
children | e6379b2e1c5c |
files | runner/main.cpp tests/test-multiple-audio/test-multiple-audio.sh |
diffstat | 2 files changed, 39 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/runner/main.cpp Wed Oct 08 18:50:44 2014 +0100 +++ b/runner/main.cpp Thu Oct 09 10:41:40 2014 +0100 @@ -137,10 +137,8 @@ return ws; } -void usage(QString myname) +void printUsage(QString myname) { - set<string> writers = FeatureWriterFactory::getWriterTags(); - cerr << endl; cerr << "Sonic Annotator v" << RUNNER_VERSION << endl; cerr << "A utility for batch feature extraction from audio files." << endl; @@ -151,18 +149,27 @@ cerr << "terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl; cerr << "This program is supplied with NO WARRANTY, to the extent permitted by law." << endl; cerr << endl; - cerr << " Usage: " << myname.toStdString() - << " [-mr] -t trans.xml [...] -w <writer> [...] <audio> [...]" << endl; - cerr << " " << myname.toStdString() - << " [-mr] -T trans.txt [...] -w <writer> [...] <audio> [...]" << endl; - cerr << " " << myname.toStdString() + cerr << "Usage: " << endl; + cerr << " " << myname.toStdString() + << " [-mrnf] -t transform.ttl [..] -w <writer> [..] <audio> [..]" << endl; + cerr << " " << myname.toStdString() + << " [-mrnf] -T translist.txt [..] -w <writer> [..] <audio> [..]" << endl; + cerr << " " << myname.toStdString() + << " [-mrnf] -d <plugin> [..] -w <writer> [..] <audio> [...]" << endl; + cerr << " " << myname.toStdString() << " -s <transform>" << endl; - cerr << " " << myname.toStdString() + cerr << " " << myname.toStdString() << " [-lhv]" << endl; cerr << endl; cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl; - cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL." << endl; + cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL;" << endl; + cerr << "and <plugin> is a plugin output identified as vamp:libname:plugin:output." << endl; cerr << endl; +} + +void printHelp(QString myname) +{ + printUsage(myname); QString extensions = AudioFileReaderFactory::getKnownExtensions(); QStringList extlist = extensions.split(" ", QString::SkipEmptyParts); @@ -187,14 +194,15 @@ cerr << "Playlist files in M3U format are also supported." << endl; cerr << endl; + cerr << "Transformation options:" << endl; cerr << endl; cerr << " -t, --transform <T> Apply transform described in transform file <T> to" << endl; cerr << " all input audio files. You may supply this option" << endl; cerr << " multiple times. You must supply this option or -T at" << endl; cerr << " least once for any work to be done. Transform format" << endl; - cerr << " may be SV transform XML or Vamp transform RDF. See" << endl; - cerr << " documentation for examples." << endl; + cerr << " may be SV transform XML or Vamp transform RDF/Turtle." << endl; + cerr << " See documentation for examples." << endl; cerr << endl; cerr << " -T, --transforms <T> Apply all transforms described in transform files" << endl; cerr << " whose names are listed in text file <T>. You may supply" << endl; @@ -211,6 +219,7 @@ cerr << endl; cerr << " -w, --writer <W> Write output using writer type <W>." << endl; cerr << " Supported writer types are: "; + set<string> writers = FeatureWriterFactory::getWriterTags(); for (set<string>::const_iterator i = writers.begin(); i != writers.end(); ) { cerr << *i; @@ -223,7 +232,7 @@ cerr << endl; cerr << " -S, --summary <S> In addition to the result features, write summary feature" << endl; cerr << " of summary type <S>." << endl; - cerr << " Supported summary types are: min, max, mean, median, mode," << endl; + cerr << " Supported summary types are min, max, mean, median, mode," << endl; cerr << " sum, variance, sd, count." << endl; cerr << " You may supply this option multiple times." << endl; cerr << endl; @@ -257,7 +266,7 @@ cerr << " and write it to standard output." << endl; cerr << endl; cerr << " -v, --version Show the version number and exit." << endl; - cerr << " -h, --help Show this help." << endl; + cerr << " -h, --help Show help." << endl; cerr << endl; cerr << "If no -w (or --writer) options are supplied, either the -l -s -v or -h option" << endl; @@ -291,7 +300,6 @@ } cerr << endl; - exit(0); } void @@ -416,7 +424,8 @@ bool last = ((i + 1) == args.size()); if (arg == "-h" || arg == "--help" || arg == "-?") { - usage(myname); + printHelp(myname); + return 0; } if (arg == "-v" || arg == "--version") {
--- a/tests/test-multiple-audio/test-multiple-audio.sh Wed Oct 08 18:50:44 2014 +0100 +++ b/tests/test-multiple-audio/test-multiple-audio.sh Thu Oct 09 10:41:40 2014 +0100 @@ -50,7 +50,17 @@ faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv -# 4. Remote playlist file referring to remote audio files +# 4. Multiple files supplied directly on command line, with file: URL + +$r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 file://`pwd`/$audiopath/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ + fail "Fails to run transform $transform with 2-file input" + +expected=$mypath/expected/playlist +csvcompare $tmpfile $expected.csv || \ + faildiff "Output mismatch for transform $transform with summaries and 2-file input using file:// URL" $tmpfile $expected.csv + + +# 5. Remote playlist file referring to remote audio files $r -t $transform -w csv --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ fail "Fails to run transform $transform with remote playlist input" @@ -60,7 +70,7 @@ faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv -# 5. Local playlist file referring to mixture of remote and local audio files +# 6. Local playlist file referring to mixture of remote and local audio files $r -t $transform -w csv --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ fail "Fails to run transform $transform with playlist of remote files" @@ -70,7 +80,7 @@ faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv -# 6. Multiple remote files supplied directly on command line +# 7. Multiple remote files supplied directly on command line $r -t $transform -w csv --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ fail "Fails to run transform $transform with 2-file remote input" @@ -80,7 +90,7 @@ faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv -# 7. Mixture of remote and local files supplied on command line +# 8. Mixture of remote and local files supplied on command line $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ fail "Fails to run transform $transform with 2-file remote input"