[grilo-plugins/wip/mschraal/tracker3-publication-date: 25/25] tracker3: Add PUBLICATION_DATE for contentCreated




commit be263953d7d7dcd9071736185f58ff70fc965447
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Aug 24 16:29:17 2020 +0200

    tracker3: Add PUBLICATION_DATE for contentCreated
    
    PUBLICATION_DATE is more in line with what the contentCreated property
    is intended for in most media. Preserve CREATION_DATE for backward
    compatability.

 src/tracker3/grl-tracker-source-api.c | 1 +
 src/tracker3/grl-tracker-utils.c      | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/tracker3/grl-tracker-source-api.c b/src/tracker3/grl-tracker-source-api.c
index ba089be7..807a464f 100644
--- a/src/tracker3/grl-tracker-source-api.c
+++ b/src/tracker3/grl-tracker-source-api.c
@@ -511,6 +511,7 @@ grl_tracker_source_writable_keys (GrlSource *source)
                                       GRL_METADATA_KEY_MB_RECORDING_ID,
                                       GRL_METADATA_KEY_MB_TRACK_ID,
                                       GRL_METADATA_KEY_MB_ARTIST_ID,
+                                      GRL_METADATA_KEY_PUBLICATION_DATE,
                                       grl_metadata_key_chromaprint,
                                       GRL_METADATA_KEY_INVALID);
   }
diff --git a/src/tracker3/grl-tracker-utils.c b/src/tracker3/grl-tracker-utils.c
index ca45249d..fc83a864 100644
--- a/src/tracker3/grl-tracker-utils.c
+++ b/src/tracker3/grl-tracker-utils.c
@@ -70,7 +70,8 @@ set_date (TrackerSparqlCursor *cursor,
   const gchar *str = tracker_sparql_cursor_get_string (cursor, column, NULL);
   if (key == GRL_METADATA_KEY_CREATION_DATE
       || key == GRL_METADATA_KEY_LAST_PLAYED
-      || key == GRL_METADATA_KEY_MODIFICATION_DATE) {
+      || key == GRL_METADATA_KEY_MODIFICATION_DATE
+      || key == GRL_METADATA_KEY_PUBLICATION_DATE) {
     GDateTime *date = grl_date_time_from_iso8601 (str);
     if (date) {
       grl_data_set_boxed (GRL_DATA (media), key, date);
@@ -354,6 +355,12 @@ grl_tracker_setup_key_mappings (void)
                                   GRL_TYPE_FILTER_ALL,
                                   set_date);
 
+  insert_key_mapping_with_setter (GRL_METADATA_KEY_PUBLICATION_DATE,
+                                  "creationDate",
+                                  "nie:contentCreated(?urn)",
+                                  GRL_TYPE_FILTER_ALL,
+                                  set_date);
+
   insert_key_mapping (GRL_METADATA_KEY_CAMERA_MODEL,
                       "cameraModel",
                       "nfo:model(nfo:equipment(?urn))",


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