# HG changeset patch
# User Chris Cannam
# Date 1228475384 0
# Node ID 3376dc26dece75b5188a1acf1b4cf2f145f7d8a8
# Parent 3176aade1a03328d4d8efc9c75003c3fb0102c2a
* Add FeatureWriter method to set basic track metadata; write it out from
RDFFeatureWriter if present
diff -r 3176aade1a03 -r 3376dc26dece data/fileio/FileSource.cpp
--- a/data/fileio/FileSource.cpp Fri Dec 05 09:40:42 2008 +0000
+++ b/data/fileio/FileSource.cpp Fri Dec 05 11:09:44 2008 +0000
@@ -110,7 +110,9 @@
emit ready();
}
+#ifdef DEBUG_FILE_SOURCE
std::cerr << "FileSource::FileSource(string) exiting" << std::endl;
+#endif
}
FileSource::FileSource(QUrl url, ProgressReporter *reporter) :
@@ -138,7 +140,9 @@
init();
+#ifdef DEBUG_FILE_SOURCE
std::cerr << "FileSource::FileSource(url) exiting" << std::endl;
+#endif
}
FileSource::FileSource(const FileSource &rf) :
@@ -188,7 +192,9 @@
m_done = true;
+#ifdef DEBUG_FILE_SOURCE
std::cerr << "FileSource::FileSource(copy ctor) exiting" << std::endl;
+#endif
}
FileSource::~FileSource()
diff -r 3176aade1a03 -r 3376dc26dece rdf/RDFFeatureWriter.cpp
--- a/rdf/RDFFeatureWriter.cpp Fri Dec 05 09:40:42 2008 +0000
+++ b/rdf/RDFFeatureWriter.cpp Fri Dec 05 11:09:44 2008 +0000
@@ -78,11 +78,21 @@
}
}
-void RDFFeatureWriter::write(QString trackId,
- const Transform &transform,
- const Plugin::OutputDescriptor& output,
- const Plugin::FeatureList& features,
- std::string summaryType)
+void
+RDFFeatureWriter::setTrackMetadata(QString trackId,
+ TrackMetadata metadata)
+{
+ std::cerr << "RDFFeatureWriter::setTrackMetadata: \""
+ << trackId.toStdString() << "\" -> \"" << metadata.title.toStdString() << "\",\"" << metadata.maker.toStdString() << "\"" << std::endl;
+ m_metadata[trackId] = metadata;
+}
+
+void
+RDFFeatureWriter::write(QString trackId,
+ const Transform &transform,
+ const Plugin::OutputDescriptor& output,
+ const Plugin::FeatureList& features,
+ std::string summaryType)
{
QString pluginId = transform.getPluginIdentifier();
@@ -170,6 +180,7 @@
stream << "@prefix dc: .\n"
<< "@prefix mo: .\n"
<< "@prefix af: .\n"
+ << "@prefix foaf: . \n"
<< "@prefix event: .\n"
<< "@prefix rdf: .\n"
<< "@prefix rdfs: .\n"
@@ -232,6 +243,16 @@
<< "> ;\n";
}
+ if (m_metadata.find(trackId) != m_metadata.end()) {
+ TrackMetadata tm = m_metadata[trackId];
+ if (tm.title != "") {
+ stream << " dc:title \"\"\"" << tm.title << "\"\"\" ;\n";
+ }
+ if (tm.maker != "") {
+ stream << " dc:creator [ a mo:MusicArtist; foaf:name \"\"\"" << tm.maker << "\"\"\" ] ;\n";
+ }
+ }
+
stream << " mo:time [\n"
<< " a tl:Interval ;\n"
<< " tl:onTimeLine "
diff -r 3176aade1a03 -r 3376dc26dece rdf/RDFFeatureWriter.h
--- a/rdf/RDFFeatureWriter.h Fri Dec 05 09:40:42 2008 +0000
+++ b/rdf/RDFFeatureWriter.h Fri Dec 05 11:09:44 2008 +0000
@@ -47,6 +47,8 @@
virtual ParameterList getSupportedParameters() const;
virtual void setParameters(map ¶ms);
+ virtual void setTrackMetadata(QString trackid, TrackMetadata metadata);
+
virtual void write(QString trackid,
const Transform &transform,
const Vamp::Plugin::OutputDescriptor &output,
@@ -59,6 +61,9 @@
typedef map RDFDescriptionMap; // by plugin id
RDFDescriptionMap m_rdfDescriptions;
+ typedef map TrackMetadataMap;
+ TrackMetadataMap m_metadata;
+
void writePrefixes(QTextStream *);
void writeSignalDescription(QTextStream *, QString);
void writeLocalFeatureTypes(QTextStream *,
diff -r 3176aade1a03 -r 3376dc26dece transform/FeatureWriter.h
--- a/transform/FeatureWriter.h Fri Dec 05 09:40:42 2008 +0000
+++ b/transform/FeatureWriter.h Fri Dec 05 11:09:44 2008 +0000
@@ -53,6 +53,12 @@
return;
}
+ struct TrackMetadata {
+ QString title;
+ QString maker;
+ };
+ virtual void setTrackMetadata(QString trackid, TrackMetadata metadata) { }
+
// may throw FailedToOpenFile or other exceptions
virtual void write(QString trackid,