[gnome-online-miners/wip/facebook] src: process photo with the parent urn now



commit 176a2553e257e46c5efd5b86d76b0ab1db546fc4
Author: Álvaro Peña <alvaropg gmail com>
Date:   Tue Jul 23 21:36:12 2013 +0200

    src: process photo with the parent urn now
    
    This change allow to link the photo with his album as parent without one extra tracker query.

 src/gom-facebook-miner.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/src/gom-facebook-miner.c b/src/gom-facebook-miner.c
index f602ff0..a9eac18 100644
--- a/src/gom-facebook-miner.c
+++ b/src/gom-facebook-miner.c
@@ -42,7 +42,7 @@ static GObject *create_service                  (GomMiner *self, GoaObject *obje
 static void     query_facebook                  (GomAccountMinerJob *job, GError **error);
 /* private functions */
 static gboolean account_miner_job_lookup_album  (GomAccountMinerJob *job, GFBGraphAlbum *album, const gchar 
*creator, GError **error);
-static gboolean account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo, const gchar 
*parent_identifier, const gchar *creator,GError **error);
+static gboolean account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo, const gchar 
*parent_resource_urn, const gchar *creator,GError **error);
 
 G_DEFINE_TYPE (GomFacebookMiner, gom_facebook_miner, GOM_TYPE_MINER)
 
@@ -234,7 +234,7 @@ account_miner_job_lookup_album (GomAccountMinerJob *job, GFBGraphAlbum *album, c
     GFBGraphPhoto *photo;
 
     photo = GFBGRAPH_PHOTO (photo_iter->data);
-    account_miner_job_process_photo (job, photo, (const gchar*) identifier, creator, error);
+    account_miner_job_process_photo (job, photo, (const gchar*) resource, creator, error);
 
     photo_iter = g_list_next (photo_iter);
   }
@@ -255,7 +255,7 @@ account_miner_job_lookup_album (GomAccountMinerJob *job, GFBGraphAlbum *album, c
 }
 
 static gboolean
-account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo, const gchar 
*parent_identifier, const gchar *creator, GError **error)
+account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo, const gchar 
*parent_resource_urn, const gchar *creator, GError **error)
 {
   const gchar *photo_id;
   const gchar *photo_name;
@@ -266,7 +266,6 @@ account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo,
   gchar *resource = NULL;
   gboolean resource_exists;
   gchar *contact_resource;
-  gchar *parent_resource_urn;
 
   photo_id = gfbgraph_node_get_id (GFBGRAPH_NODE (photo));
   photo_created_time = gfbgraph_node_get_created_time (GFBGRAPH_NODE (photo));
@@ -302,15 +301,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo,
                                                           job->cancellable, error,
                                                           job->datasource_urn, resource,
                                                           "nie:url", photo_source);
-  if (*error != NULL)
-    goto out;
 
-  /* link with the album */
-  parent_resource_urn = gom_tracker_sparql_connection_ensure_resource (job->connection,
-                                                                       job->cancellable, error,
-                                                                       NULL,
-                                                                       job->datasource_urn, 
parent_identifier,
-                                                                       "nfo:RemoteDataObject", 
"nfo:DataContainer", NULL);
   if (*error != NULL)
     goto out;
 
@@ -318,7 +309,6 @@ account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo,
                                                           job->cancellable, error,
                                                           job->datasource_urn, resource,
                                                           "nie:isPartOf", parent_resource_urn);
-  g_free (parent_resource_urn);
 
   if (*error != NULL)
     goto out;


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