Mercurial > hg > sonic-annotator
comparison runner/main.cpp @ 125:685e5cf3cb1d
Adjustments to help text; test file:// URLs
author | Chris Cannam |
---|---|
date | Thu, 09 Oct 2014 10:41:40 +0100 |
parents | dcecd6997214 |
children | f0df07da6f46 |
comparison
equal
deleted
inserted
replaced
124:c72889726a98 | 125:685e5cf3cb1d |
---|---|
135 ++i; | 135 ++i; |
136 } | 136 } |
137 return ws; | 137 return ws; |
138 } | 138 } |
139 | 139 |
140 void usage(QString myname) | 140 void printUsage(QString myname) |
141 { | 141 { |
142 set<string> writers = FeatureWriterFactory::getWriterTags(); | |
143 | |
144 cerr << endl; | 142 cerr << endl; |
145 cerr << "Sonic Annotator v" << RUNNER_VERSION << endl; | 143 cerr << "Sonic Annotator v" << RUNNER_VERSION << endl; |
146 cerr << "A utility for batch feature extraction from audio files." << endl; | 144 cerr << "A utility for batch feature extraction from audio files." << endl; |
147 cerr << "Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London." << endl; | 145 cerr << "Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London." << endl; |
148 cerr << "Copyright 2007-2014 Queen Mary, University of London." << endl; | 146 cerr << "Copyright 2007-2014 Queen Mary, University of London." << endl; |
149 cerr << endl; | 147 cerr << endl; |
150 cerr << "This program is free software. You may redistribute copies of it under the" << endl; | 148 cerr << "This program is free software. You may redistribute copies of it under the" << endl; |
151 cerr << "terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl; | 149 cerr << "terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl; |
152 cerr << "This program is supplied with NO WARRANTY, to the extent permitted by law." << endl; | 150 cerr << "This program is supplied with NO WARRANTY, to the extent permitted by law." << endl; |
153 cerr << endl; | 151 cerr << endl; |
154 cerr << " Usage: " << myname.toStdString() | 152 cerr << "Usage: " << endl; |
155 << " [-mr] -t trans.xml [...] -w <writer> [...] <audio> [...]" << endl; | 153 cerr << " " << myname.toStdString() |
156 cerr << " " << myname.toStdString() | 154 << " [-mrnf] -t transform.ttl [..] -w <writer> [..] <audio> [..]" << endl; |
157 << " [-mr] -T trans.txt [...] -w <writer> [...] <audio> [...]" << endl; | 155 cerr << " " << myname.toStdString() |
158 cerr << " " << myname.toStdString() | 156 << " [-mrnf] -T translist.txt [..] -w <writer> [..] <audio> [..]" << endl; |
157 cerr << " " << myname.toStdString() | |
158 << " [-mrnf] -d <plugin> [..] -w <writer> [..] <audio> [...]" << endl; | |
159 cerr << " " << myname.toStdString() | |
159 << " -s <transform>" << endl; | 160 << " -s <transform>" << endl; |
160 cerr << " " << myname.toStdString() | 161 cerr << " " << myname.toStdString() |
161 << " [-lhv]" << endl; | 162 << " [-lhv]" << endl; |
162 cerr << endl; | 163 cerr << endl; |
163 cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl; | 164 cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl; |
164 cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL." << endl; | 165 cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL;" << endl; |
165 cerr << endl; | 166 cerr << "and <plugin> is a plugin output identified as vamp:libname:plugin:output." << endl; |
167 cerr << endl; | |
168 } | |
169 | |
170 void printHelp(QString myname) | |
171 { | |
172 printUsage(myname); | |
166 | 173 |
167 QString extensions = AudioFileReaderFactory::getKnownExtensions(); | 174 QString extensions = AudioFileReaderFactory::getKnownExtensions(); |
168 QStringList extlist = extensions.split(" ", QString::SkipEmptyParts); | 175 QStringList extlist = extensions.split(" ", QString::SkipEmptyParts); |
169 if (!extlist.empty()) { | 176 if (!extlist.empty()) { |
170 cerr << "The following audio file extensions are recognised:" << endl; | 177 cerr << "The following audio file extensions are recognised:" << endl; |
185 cerr << endl; | 192 cerr << endl; |
186 } | 193 } |
187 | 194 |
188 cerr << "Playlist files in M3U format are also supported." << endl; | 195 cerr << "Playlist files in M3U format are also supported." << endl; |
189 cerr << endl; | 196 cerr << endl; |
197 | |
190 cerr << "Transformation options:" << endl; | 198 cerr << "Transformation options:" << endl; |
191 cerr << endl; | 199 cerr << endl; |
192 cerr << " -t, --transform <T> Apply transform described in transform file <T> to" << endl; | 200 cerr << " -t, --transform <T> Apply transform described in transform file <T> to" << endl; |
193 cerr << " all input audio files. You may supply this option" << endl; | 201 cerr << " all input audio files. You may supply this option" << endl; |
194 cerr << " multiple times. You must supply this option or -T at" << endl; | 202 cerr << " multiple times. You must supply this option or -T at" << endl; |
195 cerr << " least once for any work to be done. Transform format" << endl; | 203 cerr << " least once for any work to be done. Transform format" << endl; |
196 cerr << " may be SV transform XML or Vamp transform RDF. See" << endl; | 204 cerr << " may be SV transform XML or Vamp transform RDF/Turtle." << endl; |
197 cerr << " documentation for examples." << endl; | 205 cerr << " See documentation for examples." << endl; |
198 cerr << endl; | 206 cerr << endl; |
199 cerr << " -T, --transforms <T> Apply all transforms described in transform files" << endl; | 207 cerr << " -T, --transforms <T> Apply all transforms described in transform files" << endl; |
200 cerr << " whose names are listed in text file <T>. You may supply" << endl; | 208 cerr << " whose names are listed in text file <T>. You may supply" << endl; |
201 cerr << " this option multiple times." << endl; | 209 cerr << " this option multiple times." << endl; |
202 cerr << endl; | 210 cerr << endl; |
209 cerr << " this in production systems. You may supply this option" << endl; | 217 cerr << " this in production systems. You may supply this option" << endl; |
210 cerr << " multiple times, and mix it with -t and -T." << endl; | 218 cerr << " multiple times, and mix it with -t and -T." << endl; |
211 cerr << endl; | 219 cerr << endl; |
212 cerr << " -w, --writer <W> Write output using writer type <W>." << endl; | 220 cerr << " -w, --writer <W> Write output using writer type <W>." << endl; |
213 cerr << " Supported writer types are: "; | 221 cerr << " Supported writer types are: "; |
222 set<string> writers = FeatureWriterFactory::getWriterTags(); | |
214 for (set<string>::const_iterator i = writers.begin(); | 223 for (set<string>::const_iterator i = writers.begin(); |
215 i != writers.end(); ) { | 224 i != writers.end(); ) { |
216 cerr << *i; | 225 cerr << *i; |
217 if (++i != writers.end()) cerr << ", "; | 226 if (++i != writers.end()) cerr << ", "; |
218 else cerr << "."; | 227 else cerr << "."; |
221 cerr << " You may supply this option multiple times. You must" << endl; | 230 cerr << " You may supply this option multiple times. You must" << endl; |
222 cerr << " supply this option at least once for any work to be done." << endl; | 231 cerr << " supply this option at least once for any work to be done." << endl; |
223 cerr << endl; | 232 cerr << endl; |
224 cerr << " -S, --summary <S> In addition to the result features, write summary feature" << endl; | 233 cerr << " -S, --summary <S> In addition to the result features, write summary feature" << endl; |
225 cerr << " of summary type <S>." << endl; | 234 cerr << " of summary type <S>." << endl; |
226 cerr << " Supported summary types are: min, max, mean, median, mode," << endl; | 235 cerr << " Supported summary types are min, max, mean, median, mode," << endl; |
227 cerr << " sum, variance, sd, count." << endl; | 236 cerr << " sum, variance, sd, count." << endl; |
228 cerr << " You may supply this option multiple times." << endl; | 237 cerr << " You may supply this option multiple times." << endl; |
229 cerr << endl; | 238 cerr << endl; |
230 cerr << " --summary-only Write only summary features; do not write the regular" << endl; | 239 cerr << " --summary-only Write only summary features; do not write the regular" << endl; |
231 cerr << " result features." << endl; | 240 cerr << " result features." << endl; |
255 cerr << endl; | 264 cerr << endl; |
256 cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl; | 265 cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl; |
257 cerr << " and write it to standard output." << endl; | 266 cerr << " and write it to standard output." << endl; |
258 cerr << endl; | 267 cerr << endl; |
259 cerr << " -v, --version Show the version number and exit." << endl; | 268 cerr << " -v, --version Show the version number and exit." << endl; |
260 cerr << " -h, --help Show this help." << endl; | 269 cerr << " -h, --help Show help." << endl; |
261 | 270 |
262 cerr << endl; | 271 cerr << endl; |
263 cerr << "If no -w (or --writer) options are supplied, either the -l -s -v or -h option" << endl; | 272 cerr << "If no -w (or --writer) options are supplied, either the -l -s -v or -h option" << endl; |
264 cerr << "(or long equivalent) must be given instead." << endl; | 273 cerr << "(or long equivalent) must be given instead." << endl; |
265 | 274 |
289 cerr << s.toStdString() << endl; | 298 cerr << s.toStdString() << endl; |
290 } | 299 } |
291 } | 300 } |
292 | 301 |
293 cerr << endl; | 302 cerr << endl; |
294 exit(0); | |
295 } | 303 } |
296 | 304 |
297 void | 305 void |
298 listTransforms() | 306 listTransforms() |
299 { | 307 { |
414 | 422 |
415 QString arg = args[i]; | 423 QString arg = args[i]; |
416 bool last = ((i + 1) == args.size()); | 424 bool last = ((i + 1) == args.size()); |
417 | 425 |
418 if (arg == "-h" || arg == "--help" || arg == "-?") { | 426 if (arg == "-h" || arg == "--help" || arg == "-?") { |
419 usage(myname); | 427 printHelp(myname); |
428 return 0; | |
420 } | 429 } |
421 | 430 |
422 if (arg == "-v" || arg == "--version") { | 431 if (arg == "-v" || arg == "--version") { |
423 std::cout << RUNNER_VERSION << std::endl; | 432 std::cout << RUNNER_VERSION << std::endl; |
424 return 0; | 433 return 0; |