[grilo-plugins/wip/mschraal/tracker3-publication-date-fix: 6/6] tracker3: Fix PUBLICATION_DATE writeback




commit c6cf837287cc54f92c490a2c0f4ebc7845577cc4
Author: Marinus Schraal <mschraal gnome org>
Date:   Sat Sep 5 18:18:04 2020 +0200

    tracker3: Fix PUBLICATION_DATE writeback
    
    be263953d7 introduced the use of the PUBLICATION_DATE key. The sparql
    variable name for writeback however should be publicationDate to work.
    The writeback resource builder should deal with the "publication date"
    metadata key as well.
    
    Related: !90

 src/tracker3/grl-tracker-utils.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/tracker3/grl-tracker-utils.c b/src/tracker3/grl-tracker-utils.c
index fc83a864..53aef814 100644
--- a/src/tracker3/grl-tracker-utils.c
+++ b/src/tracker3/grl-tracker-utils.c
@@ -356,7 +356,7 @@ grl_tracker_setup_key_mappings (void)
                                   set_date);
 
   insert_key_mapping_with_setter (GRL_METADATA_KEY_PUBLICATION_DATE,
-                                  "creationDate",
+                                  "publicationDate",
                                   "nie:contentCreated(?urn)",
                                   GRL_TYPE_FILTER_ALL,
                                   set_date);
@@ -586,6 +586,14 @@ grl_tracker_build_resource_from_media (GrlMedia *media, GList *keys)
       date = g_date_time_format_iso8601 (creation);
       tracker_resource_set_string (resource, "nie:contentCreated", date);
       g_free (date);
+    } else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_PUBLICATION_DATE)) {
+      GDateTime *publication;
+      gchar *date;
+
+      publication = grl_media_get_publication_date (media);
+      date = g_date_time_format_iso8601 (publication);
+      tracker_resource_set_string (resource, "nie:contentCreated", date);
+      g_free (date);
     } else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_ALBUM)) {
       TrackerResource *album;
       album = ensure_resource_for_property (resource, "nmm:musicAlbum", FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]