[tracker-miners/wip/carlosg/extraction-fixes: 2/3] tracker-extract-gstreamer: Set Acoustid nfo:hasHash on file resource
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/extraction-fixes: 2/3] tracker-extract-gstreamer: Set Acoustid nfo:hasHash on file resource
- Date: Wed, 30 Sep 2020 18:13:18 +0000 (UTC)
commit 27bd462d24fa5ca2dd06a0f87c5407a894545d68
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Sep 30 18:11:37 2020 +0200
tracker-extract-gstreamer: Set Acoustid nfo:hasHash on file resource
This is wrongly set on the nie:InformationElement, not on the
nfo:FileDataObject where it belongs. Causes SPARQL insertion errors for
files with chromaprint tags.
We were even testing for it wrong in the audio/flac-musicbrainz test,
update the expected output there.
Fixes: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/141
src/tracker-extract/tracker-extract-gstreamer.c | 6 +++++-
.../audio/flac-musicbrainz.expected.json | 16 +++++++++-------
2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index a05da120c..3efe78146 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -633,6 +633,7 @@ ensure_file_resource (TrackerResource *resource,
static void
extractor_apply_audio_metadata (MetadataExtractor *extractor,
GstTagList *tag_list,
+ const gchar *file_url,
TrackerResource *audio,
TrackerResource *artist,
TrackerResource *performer,
@@ -683,12 +684,13 @@ extractor_apply_audio_metadata (MetadataExtractor *extractor,
have_acoustid_fingerprint = gst_tag_list_copy_value (&acoustid_fingerprint, tag_list,
GST_TAG_ACOUSTID_FINGERPRINT);
if (have_acoustid_fingerprint) {
TrackerResource *hash_resource = tracker_resource_new (NULL);
+ TrackerResource *file_resource = ensure_file_resource (audio, file_url);
tracker_resource_set_uri (hash_resource, "rdf:type", "nfo:FileHash");
tracker_resource_set_gvalue (hash_resource, "nfo:hashValue", &acoustid_fingerprint);
tracker_resource_set_string (hash_resource, "nfo:hashAlgorithm", "chromaprint");
- tracker_resource_add_take_relation (audio, "nfo:hasHash", hash_resource);
+ tracker_resource_add_take_relation (file_resource, "nfo:hasHash", hash_resource);
g_value_unset (&acoustid_fingerprint);
}
#endif
@@ -769,6 +771,7 @@ extract_track (TrackerResource *track,
extractor_apply_audio_metadata (extractor,
toc_entry->tag_list,
+ file_url,
track,
track_artist,
track_performer,
@@ -983,6 +986,7 @@ extract_metadata (MetadataExtractor *extractor,
} else {
extractor_apply_audio_metadata (extractor,
extractor->tagcache,
+ file_url,
resource,
artist,
performer,
diff --git a/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
b/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
index 69428f522..d568a2afc 100644
--- a/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
@@ -79,12 +79,14 @@
"tracker:referenceIdentifier": "dfgj-432-iu7"
}
],
- "nfo:hasHash": [
- {
- "@type": "nfo:hasHash",
- "nfo:hashAlgorithm": "chromaprint",
- "nfo:hashValue": "123453215"
- }
- ]
+ "nie:isStoredAs": {
+ "nfo:hasHash": [
+ {
+ "@type": "nfo:hasHash",
+ "nfo:hashAlgorithm": "chromaprint",
+ "nfo:hashValue": "123453215"
+ }
+ ]
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]