Mercurial > hg > sonic-annotator
diff runner/main.cpp @ 265:0be716283c61 piper-nopiper
More error reporting updates
author | Chris Cannam |
---|---|
date | Wed, 23 Nov 2016 12:05:53 +0000 |
parents | 68dc2d99a5b1 |
children | bfad84d0bb1d |
line wrap: on
line diff
--- a/runner/main.cpp Wed Nov 23 10:42:35 2016 +0000 +++ b/runner/main.cpp Wed Nov 23 12:05:53 2016 +0000 @@ -478,7 +478,7 @@ QDir dir(dirname); QString printable = dir.dirName().left(20); - cerr << "\rScanning \"" << printable << "\"..." + SVCERR << "\rScanning \"" << printable << "\"..." << QString(" ").left(20 - printable.length()) << " [" << found << " audio file(s)]"; @@ -505,6 +505,7 @@ QStringList expanded; foreach (QString path, sources) { if (QFileInfo(path).suffix().toLower() == "m3u") { + SVDEBUG << "Expanding m3u playlist file \"" << path << "\"" << endl; ProgressPrinter retrievalProgress("Opening playlist file..."); FileSource source(path, &retrievalProgress); if (!source.isAvailable()) { @@ -523,6 +524,8 @@ for (int i = 0; i < (int)files.size(); ++i) { expanded.push_back(files[i]); } + SVDEBUG << "Done, m3u playlist references " + << files.size() << " file(s)" << endl; } } else { // not a playlist @@ -538,7 +541,7 @@ { FileSource source(url); if (!source.isAvailable()) { - cerr << "File or URL \"" << url << "\" could not be retrieved" << endl; + SVCERR << "File or URL \"" << url << "\" could not be retrieved" << endl; return false; } source.waitForData(); @@ -546,7 +549,7 @@ QString filename = source.getLocalFilename(); QFile file(filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - cerr << "File \"" << filename << "\" could not be read" << endl; + SVCERR << "File \"" << filename << "\" could not be read" << endl; return false; } @@ -569,7 +572,7 @@ importantBit = bits[0]; } if (importantBit == QString()) { - cerr << "WARNING: Skipping line " << lineNo << " (no content found)" + SVCERR << "WARNING: Skipping line " << lineNo << " (no content found)" << endl; continue; } @@ -577,7 +580,7 @@ boundaries.insert(Vamp::RealTime::fromSeconds (importantBit.toDouble(&good))); if (!good) { - cerr << "Unparseable or non-numeric segment boundary at line " + SVCERR << "Unparseable or non-numeric segment boundary at line " << lineNo << endl; return false; } @@ -1044,6 +1047,7 @@ for (set<string>::const_iterator i = requestedTransformListFiles.begin(); i != requestedTransformListFiles.end(); ++i) { + SVDEBUG << "Reading transform list file \"" << *i << "\"" << endl; PlaylistFileReader reader(i->c_str()); if (reader.isOK()) { vector<QString> files = reader.load(); @@ -1051,7 +1055,7 @@ requestedTransformFiles.insert(files[j].toStdString()); } } else { - cerr << myname << ": failed to read template list file \"" << *i << "\"" << endl; + SVCERR << myname << ": failed to read transform list file \"" << *i << "\"" << endl; exit(2); } } @@ -1063,10 +1067,10 @@ for (QStringList::const_iterator i = otherArgs.begin(); i != otherArgs.end(); ++i) { if (QDir(*i).exists()) { - cerr << "Directory found and recursive flag set, scanning for audio files..." << endl; + SVCERR << "Directory found and recursive flag set, scanning for audio files..." << endl; int found = 0; findSourcesRecursive(*i, sources, found); - cerr << "\rDone, found " << found << " supported audio file(s) " << endl; + SVCERR << "\rDone, found " << found << " supported audio file(s) " << endl; } else { sources.push_back(*i); } @@ -1084,16 +1088,16 @@ manager.addSource(*i, multiplex); } catch (const std::exception &e) { badSources.insert(*i); - cerr << "ERROR: Failed to process file \"" << i->toStdString() + SVCERR << "ERROR: Failed to process file \"" << i->toStdString() << "\": " << e.what() << endl; if (force) { // print a note only if we have more files to process QStringList::const_iterator j = i; if (++j != sources.end()) { - cerr << "NOTE: \"--force\" option was provided, continuing (more errors may occur)" << endl; + SVCERR << "NOTE: \"--force\" option was provided, continuing (more errors may occur)" << endl; } } else { - cerr << "NOTE: If you want to continue with processing any further files after an" << endl + SVCERR << "NOTE: If you want to continue with processing any further files after an" << endl << "error like this, use the --force option" << endl; good = false; break; @@ -1110,7 +1114,7 @@ if (manager.addFeatureExtractorFromFile(i->c_str(), writers)) { haveFeatureExtractor = true; } else { - cerr << "ERROR: Failed to add feature extractor from transform file \"" << *i << "\"" << endl; + SVCERR << "ERROR: Failed to add feature extractor from transform file \"" << *i << "\"" << endl; good = false; } } @@ -1120,13 +1124,13 @@ if (manager.addDefaultFeatureExtractor(i->c_str(), writers)) { haveFeatureExtractor = true; } else { - cerr << "ERROR: Failed to add default feature extractor for transform \"" << *i << "\"" << endl; + SVCERR << "ERROR: Failed to add default feature extractor for transform \"" << *i << "\"" << endl; good = false; } } if (!haveFeatureExtractor) { - cerr << myname << ": no feature extractors added" << endl; + SVCERR << myname << ": no feature extractors added" << endl; good = false; } } @@ -1145,7 +1149,7 @@ } manager.extractFeaturesMultiplexed(goodSources); } catch (const std::exception &e) { - cerr << "ERROR: Feature extraction failed: " + SVCERR << "ERROR: Feature extraction failed: " << e.what() << endl; } } else {