Commit 56eb8360 authored by Carlos Garnacho's avatar Carlos Garnacho

tracker-extract: Use tracker_resource_set_* with single-valued properties

The tracker_resource_add_* API does not delete the previous property value,
so may result in constraint errors if these values happen to change (some
are more likely than others).

This commit fixes this entire source of bugs en-masse, the affected
properties were:

- nmm:albumDiscAlbum
- nfo:genre in GStreamer extractor
- nie:license in HTML extractor
- nco:publisher and nfo:equipment in JPEG extractor
- nfo:equipment in RAW extractor
parent 27eb798a
......@@ -290,7 +290,7 @@ tracker_extract_new_music_album_disc (const char *album_title,
tracker_resource_set_uri (album_disc, "rdf:type", "nmm:MusicAlbumDisc");
tracker_resource_set_int (album_disc, "nmm:setNumber", disc_number > 0 ? disc_number : 1);
tracker_resource_add_relation (album_disc, "nmm:albumDiscAlbum", album);
tracker_resource_set_relation (album_disc, "nmm:albumDiscAlbum", album);
g_free (tmp_album_uri);
g_free (tmp_disc_uri);
......
......@@ -518,7 +518,7 @@ extractor_apply_general_metadata (MetadataExtractor *extractor,
gst_tag_list_get_string (tag_list, GST_TAG_TITLE, &title);
if (genre && g_strcmp0 (genre, "Unknown") != 0) {
tracker_resource_add_string (resource, "nfo:genre", genre);
tracker_resource_set_string (resource, "nfo:genre", genre);
}
tracker_guarantee_resource_title_from_file (resource,
......
......@@ -112,7 +112,7 @@ parser_start_element (void *data,
href = lookup_attribute (attrs, "href");
if (href && !pd->has_license) {
tracker_resource_add_string (pd->metadata, "nie:license", href);
tracker_resource_set_string (pd->metadata, "nie:license", href);
pd->has_license = TRUE;
}
}
......
......@@ -334,7 +334,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
if (xd->publisher) {
TrackerResource *publisher = tracker_extract_new_contact (xd->publisher);
tracker_resource_add_relation (metadata, "nco:publisher", publisher);
tracker_resource_set_relation (metadata, "nco:publisher", publisher);
g_object_unref (publisher);
}
......@@ -397,7 +397,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
if (md.make || md.model) {
TrackerResource *equipment = tracker_extract_new_equipment (md.make, md.model);
tracker_resource_add_relation (metadata, "nfo:equipment", equipment);
tracker_resource_set_relation (metadata, "nfo:equipment", equipment);
g_object_unref (equipment);
}
......
......@@ -365,7 +365,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
TrackerResource *equipment;
equipment = tracker_extract_new_equipment (ed->make, ed->model);
tracker_resource_add_relation (resource, "nfo:equipment", equipment);
tracker_resource_set_relation (resource, "nfo:equipment", equipment);
g_object_unref (equipment);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment