diff rdf/RDFFeatureWriter.h @ 1144:c8e291700c0e

Write Track in RDF only if title/artist metadata present, not simply on the basis of a TrackMetadata object existing
author Chris Cannam
date Wed, 04 Nov 2015 12:06:12 +0000
parents e25dc8d57565
children c01cbe41aeb5
line wrap: on
line diff
--- a/rdf/RDFFeatureWriter.h	Wed Nov 04 10:07:29 2015 +0000
+++ b/rdf/RDFFeatureWriter.h	Wed Nov 04 12:06:12 2015 +0000
@@ -70,6 +70,19 @@
     typedef map<QString, TrackMetadata> TrackMetadataMap;
     TrackMetadataMap m_metadata;
 
+    bool haveTitleArtistMetadata(QString trackId) const {
+        // Formerly in various places we used to test whether a track
+        // appeared in the metadata map at all, in order to determine
+        // whether it had any associated metadata. That won't work any
+        // more because metadata now includes duration, which can
+        // appear even if no title/artist are given and which is not
+        // something whose presence indicates the involvement of a
+        // "publication Track". So check for artist/title explicitly.
+        auto mitr = m_metadata.find(trackId);
+        if (mitr == m_metadata.end()) return false;
+        return (mitr->second.title != "" || mitr->second.maker != "");
+    }
+
     QString m_fixedEventTypeURI;
 
     virtual void reviewFileForAppending(QString filename);