[grilo-plugins] flickr: Deal with photos only



commit d0e46b32be5d279b4c6227371ba5eeadcaa3100e
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Mon Oct 29 18:16:42 2012 +0000

    flickr: Deal with photos only
    
    While Flickr can store videos, API is mainly designed to deal with photos.
    Actually, when we get a video from Flickr, its current URL do not point to the
    video itself, but rather to a thumbnail capture.
    
    As most people identify Flickr with photo storage service, let's focus in
    photos and do not return videos.

 src/flickr/gflickr.c    |   17 +++++++++++------
 src/flickr/grl-flickr.c |    8 +-------
 2 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/src/flickr/gflickr.c b/src/flickr/gflickr.c
index 70447b0..c7b1b0b 100644
--- a/src/flickr/gflickr.c
+++ b/src/flickr/gflickr.c
@@ -44,9 +44,10 @@
   "&api_sig=%s"                                         \
   "&method=" FLICKR_PHOTOS_SEARCH_METHOD                \
   "&user_id=%s"                                         \
-  "&extras=media,date_taken,owner_name,url_o,url_t"     \
+  "&extras=date_taken,owner_name,url_o,url_t"           \
   "&per_page=%d"                                        \
   "&page=%d"                                            \
+  "&media=photos"                                       \
   "&tags=%s"                                            \
   "&text=%s"                                            \
   "%s"
@@ -56,7 +57,7 @@
   "api_key=%s"                                          \
   "&api_sig=%s"                                         \
   "&method=" FLICKR_PHOTOS_GETRECENT_METHOD             \
-  "&extras=media,date_taken,owner_name,url_o,url_t"     \
+  "&extras=date_taken,owner_name,url_o,url_t"           \
   "&per_page=%d"                                        \
   "&page=%d"                                            \
   "%s"
@@ -75,9 +76,10 @@
   "&api_sig=%s"                                         \
   "&method=" FLICKR_PHOTOSETS_GETPHOTOS_METHOD          \
   "&photoset_id=%s"                                     \
-  "&extras=media,date_taken,owner_name,url_o,url_t"     \
+  "&extras=date_taken,owner_name,url_o,url_t"           \
   "&per_page=%d"                                        \
   "&page=%d"                                            \
+  "&media=photos"                                       \
   "%s"
 
 #define FLICKR_TAGS_GETHOTLIST                          \
@@ -704,7 +706,8 @@ g_flickr_photos_search (GFlickr *f,
   gchar *api_sig =
     get_api_sig (f->priv->auth_secret,
                  "api_key", f->priv->api_key,
-                 "extras", "media,date_taken,owner_name,url_o,url_t",
+                 "extras", "date_taken,owner_name,url_o,url_t",
+                 "media", "photos",
                  "method", FLICKR_PHOTOS_SEARCH_METHOD,
                  "user_id", user_id,
                  "page", strpage,
@@ -761,7 +764,8 @@ g_flickr_photos_getRecent (GFlickr *f,
   gchar *api_sig =
     get_api_sig (f->priv->auth_secret,
                  "api_key", f->priv->api_key,
-                 "extras", "media,date_taken,owner_name,url_o,url_t",
+                 "extras", "date_taken,owner_name,url_o,url_t",
+                 "media", "photos",
                  "method", FLICKR_PHOTOS_GETRECENT_METHOD,
                  "page", strpage,
                  "per_page", strperpage,
@@ -999,7 +1003,8 @@ g_flickr_photosets_getPhotos (GFlickr *f,
     get_api_sig (f->priv->auth_secret,
                  "api_key", f->priv->api_key,
                  "photoset_id", photoset_id,
-                 "extras", "media,date_taken,owner_name,url_o,url_t",
+                 "extras", "date_taken,owner_name,url_o,url_t",
+                 "media", "photos",
                  "method", FLICKR_PHOTOSETS_GETPHOTOS_METHOD,
                  "page", strpage,
                  "per_page", strperpage,
diff --git a/src/flickr/grl-flickr.c b/src/flickr/grl-flickr.c
index 44030c2..b2a4129 100644
--- a/src/flickr/grl-flickr.c
+++ b/src/flickr/grl-flickr.c
@@ -394,7 +394,6 @@ search_cb (GFlickr *f, GList *photolist, gpointer user_data)
 {
   GrlMedia *media;
   OperationData *od = (OperationData *) user_data;
-  gchar *media_type;
 
   /* Go to offset element */
   photolist = g_list_nth (photolist, od->offset);
@@ -412,12 +411,7 @@ search_cb (GFlickr *f, GList *photolist, gpointer user_data)
   }
 
   while (photolist && od->count) {
-    media_type = g_hash_table_lookup (photolist->data, "photo_media");
-    if (strcmp (media_type, "photo") == 0) {
-      media = grl_media_image_new ();
-    } else {
-      media = grl_media_video_new ();
-    }
+    media = grl_media_image_new ();
     update_media (media, photolist->data);
     od->callback (od->source,
                   od->operation_id,



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