Mercurial > hg > svcore
changeset 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 | d649818fc249 |
children | 9c7633904ec2 |
files | rdf/RDFFeatureWriter.cpp rdf/RDFFeatureWriter.h |
diffstat | 2 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rdf/RDFFeatureWriter.cpp Wed Nov 04 10:07:29 2015 +0000 +++ b/rdf/RDFFeatureWriter.cpp Wed Nov 04 12:06:12 2015 +0000 @@ -352,7 +352,7 @@ bool wantTrack = (userSpecifiedTrack || (m_userMakerUri != "") || - (m_metadata.find(trackId) != m_metadata.end())); + haveTitleArtistMetadata(trackId)); // cerr << "wantTrack = " << wantTrack << " (userSpecifiedTrack = " // << userSpecifiedTrack << ", m_userMakerUri = " << m_userMakerUri << ", have metadata = " << (m_metadata.find(trackId) != m_metadata.end()) << ")" << endl; @@ -367,7 +367,7 @@ // including a Track would be to assert that this was one, // which is the one thing we wouldn't know... TrackMetadata tm; - if (m_metadata.find(trackId) != m_metadata.end()) { + if (haveTitleArtistMetadata(trackId)) { tm = m_metadata[trackId]; } stream << trackURI << " a mo:Track ";
--- 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);