Mercurial > hg > svcore
changeset 1002:c2316a3bbb81
Add omit-filename option to CSV writer (and test it while testing lab writer)
author | Chris Cannam |
---|---|
date | Wed, 15 Oct 2014 10:38:17 +0100 |
parents | 51bf067de517 |
children | 274c4362bda6 |
files | transform/CSVFeatureWriter.cpp transform/CSVFeatureWriter.h |
diffstat | 2 files changed, 22 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/transform/CSVFeatureWriter.cpp Wed Oct 15 10:18:13 2014 +0100 +++ b/transform/CSVFeatureWriter.cpp Wed Oct 15 10:38:17 2014 +0100 @@ -35,7 +35,8 @@ m_separator(","), m_sampleTiming(false), m_endTimes(false), - m_forceEnd(false) + m_forceEnd(false), + m_omitFilename(false) { } @@ -60,6 +61,11 @@ p.hasArg = true; pl.push_back(p); + p.name = "omit-filename"; + p.description = "Omit the filename column. May result in confusion if sending more than one audio file's features to the same CSV output."; + p.hasArg = false; + pl.push_back(p); + p.name = "sample-timing"; p.description = "Show timings as sample frame counts instead of in seconds."; p.hasArg = false; @@ -89,12 +95,18 @@ cerr << i->first << " -> " << i->second << endl; if (i->first == "separator") { m_separator = i->second.c_str(); + cerr << "m_separator = " << m_separator << endl; + if (m_separator == "\\t") { + m_separator = QChar::Tabulation; + } } else if (i->first == "sample-timing") { m_sampleTiming = true; } else if (i->first == "end-times") { m_endTimes = true; } else if (i->first == "fill-ends") { m_forceEnd = true; + } else if (i->first == "omit-filename") { + m_omitFilename = true; } } } @@ -186,12 +198,14 @@ QString trackId = tt.first; TransformId transformId = tt.second; - if (m_stdout || m_singleFileName != "") { - if (trackId != m_prevPrintedTrackId) { - stream << "\"" << trackId << "\"" << m_separator; - m_prevPrintedTrackId = trackId; - } else { - stream << m_separator; + if (!m_omitFilename) { + if (m_stdout || m_singleFileName != "") { + if (trackId != m_prevPrintedTrackId) { + stream << "\"" << trackId << "\"" << m_separator; + m_prevPrintedTrackId = trackId; + } else { + stream << m_separator; + } } }
--- a/transform/CSVFeatureWriter.h Wed Oct 15 10:18:13 2014 +0100 +++ b/transform/CSVFeatureWriter.h Wed Oct 15 10:38:17 2014 +0100 @@ -60,6 +60,7 @@ bool m_sampleTiming; bool m_endTimes; bool m_forceEnd; + bool m_omitFilename; QString m_prevPrintedTrackId; typedef map<TrackTransformPair, Vamp::Plugin::Feature> PendingFeatures;