[tracker-miners: 1/2] Update nfo:fileLastModified also on content specific graphs




commit 48250ea286a39c048b7458029388e3f87f3ab4ba
Author: Pekka Vuorela <pekka vuorela jolla com>
Date:   Tue Sep 21 19:38:08 2021 +0300

    Update nfo:fileLastModified also on content specific graphs
    
    Executing 'touch' on a file was updating only tracker:FileSystem.

 src/miners/fs/tracker-miner-files.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 35ac13381..8d68b2dc7 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2207,8 +2207,9 @@ miner_files_process_file_attributes (TrackerMinerFS      *fs,
                                      GFileInfo           *info,
                                      TrackerSparqlBuffer *buffer)
 {
-       TrackerResource *resource;
+       TrackerResource *resource, *graph_file;
        gchar *uri;
+       const gchar *mime_type, *graph;
        GDateTime *modified;
 #ifdef GIO_SUPPORTS_CREATION_TIME
        GDateTime *accessed, *created;
@@ -2233,8 +2234,17 @@ miner_files_process_file_attributes (TrackerMinerFS      *fs,
        if (!modified)
                modified = g_date_time_new_from_unix_utc (0);
 
+       mime_type = g_file_info_get_content_type (info);
+       graph = tracker_extract_module_manager_get_graph (mime_type);
+
        /* Update nfo:fileLastModified */
        tracker_resource_set_datetime (resource, "nfo:fileLastModified", modified);
+       if (graph) {
+               graph_file = tracker_resource_new (uri);
+               tracker_resource_set_datetime (graph_file, "nfo:fileLastModified", modified);
+               tracker_sparql_buffer_push (buffer, file, graph, graph_file);
+               g_clear_object (&graph_file);
+       }
        g_date_time_unref (modified);
 
 #ifdef GIO_SUPPORTS_CREATION_TIME


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