# HG changeset patch # User Chris Cannam # Date 1413365897 -3600 # Node ID c2316a3bbb814eb70f817bd0ed30543f00a68352 # Parent 51bf067de517cc9ce385c013315e0b92d2dac114 Add omit-filename option to CSV writer (and test it while testing lab writer) diff -r 51bf067de517 -r c2316a3bbb81 transform/CSVFeatureWriter.cpp --- 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; + } } } diff -r 51bf067de517 -r c2316a3bbb81 transform/CSVFeatureWriter.h --- 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 PendingFeatures;