[grilo-plugins] flickr: Set MIME-type for media



commit c2ceb922d7adfd4708b6e5f2478bf3765f4d71e7
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 18 10:43:26 2014 +0100

    flickr: Set MIME-type for media
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724615

 src/flickr/grl-flickr.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/flickr/grl-flickr.c b/src/flickr/grl-flickr.c
index 94df83e..15dc6b0 100644
--- a/src/flickr/grl-flickr.c
+++ b/src/flickr/grl-flickr.c
@@ -505,7 +505,21 @@ update_media (GrlMedia *media, GHashTable *photo)
   }
 
   if (url) {
+    gchar *content_type;
+
     grl_media_set_url (media, url);
+
+    content_type = g_content_type_guess (url, NULL, 0, NULL);
+    if (content_type) {
+      gchar *mime;
+
+      mime = g_content_type_get_mime_type (content_type);
+      if (mime) {
+        grl_media_set_mime (media, mime);
+        g_free (mime);
+      }
+      g_free (content_type);
+    }
     g_free (url);
   }
 
@@ -850,6 +864,7 @@ grl_flickr_source_supported_keys (GrlSource *source)
                                       GRL_METADATA_KEY_CREATION_DATE,
                                       GRL_METADATA_KEY_DESCRIPTION,
                                       GRL_METADATA_KEY_ID,
+                                      GRL_METADATA_KEY_MIME,
                                       GRL_METADATA_KEY_THUMBNAIL,
                                       GRL_METADATA_KEY_TITLE,
                                       GRL_METADATA_KEY_URL,


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