[gnome-online-miners/wip/facebook] src: used _get GFBPhoto functions.



commit d09ddb56d642a010d0ac074c3bc651e7a9981406
Author: Álvaro Peña <alvaropg gmail com>
Date:   Tue Jul 23 21:32:33 2013 +0200

    src: used _get GFBPhoto functions.

 src/gom-facebook-miner.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/src/gom-facebook-miner.c b/src/gom-facebook-miner.c
index 972afd8..a9b9bf6 100644
--- a/src/gom-facebook-miner.c
+++ b/src/gom-facebook-miner.c
@@ -260,10 +260,10 @@ 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)
 {
-  gchar *photo_id;
-  gchar *photo_name;
-  gchar *photo_source;
-  gchar *photo_created_time;
+  const gchar *photo_id;
+  const gchar *photo_name;
+  const gchar *photo_source;
+  const gchar *photo_created_time;
   gchar *identifier;
   const gchar *class = "nmm:Photo";
   gchar *resource = NULL;
@@ -271,12 +271,13 @@ account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo,
   gchar *contact_resource;
   gchar *parent_resource_urn;
 
-  g_object_get (photo,
-                "id", &photo_id,
-                "name", &photo_name,
-                "source", &photo_source,
-                "created_time", &photo_created_time,
-                NULL);
+  photo_id = gfbgraph_node_get_id (GFBGRAPH_NODE (photo));
+  photo_created_time = gfbgraph_node_get_created_time (GFBGRAPH_NODE (photo));
+  photo_name = gfbgraph_photo_get_name (photo);
+  if (photo_name == NULL) {
+    photo_name = photo_created_time;
+  }
+  photo_source = gfbgraph_photo_get_default_source_uri (photo);
 
   identifier = g_strdup_printf ("facebook:photos:%s", photo_id);
 
@@ -325,10 +326,6 @@ account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo,
   if (*error != NULL)
     goto out;
 
-  /* insert the photo title, sometimes, there is not a photo name, so we use the ugly photo id */
-  if (photo_name == NULL) {
-    photo_name = g_strdup (photo_id);
-  }
   gom_tracker_sparql_connection_insert_or_replace_triple (job->connection,
                                                           job->cancellable, error,
                                                           job->datasource_urn, resource,
@@ -360,10 +357,6 @@ account_miner_job_process_photo (GomAccountMinerJob *job, GFBGraphPhoto *photo,
     goto out;
 
  out:
-  g_free (photo_id);
-  g_free (photo_name);
-  g_free (photo_source);
-  g_free (photo_created_time);
   g_free (identifier);
   g_free (resource);
   g_free (contact_resource);


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