[grilo-plugins] dmap: copy some more attributes from DAAP media record to Grilo media record



commit b956ad97e6f96c323171ec9e48ff99e92cf4c10e
Author: W. Michael Petullo <mike flyn org>
Date:   Wed Jan 8 21:26:46 2014 -0500

    dmap: copy some more attributes from DAAP media record to Grilo media record
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 src/dmap/grl-dmap.c |   69 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 54 insertions(+), 15 deletions(-)
---
diff --git a/src/dmap/grl-dmap.c b/src/dmap/grl-dmap.c
index 54c6ddc..b31c235 100644
--- a/src/dmap/grl-dmap.c
+++ b/src/dmap/grl-dmap.c
@@ -236,22 +236,37 @@ add_media_from_service (gpointer id,
                         DAAPRecord *record,
                         ResultCbAndArgs *cb)
 {
-  gchar *id_s   = NULL,
-    *title  = NULL,
-    *url    = NULL;
-  int duration  = 0;
+  gint   duration = 0;
+  gint32  bitrate = 0,
+            track = 0;
+  gchar  *id_s    = NULL,
+         *title   = NULL,
+         *album   = NULL,
+         *artist  = NULL,
+         *genre   = NULL,
+         *url     = NULL;
   gboolean has_video;
   GrlMedia *media;
 
   g_object_get (record,
-                "title",
-                &title,
-                "location",
-                &url,
-                "has-video",
-                &has_video,
-                "duration",
-                &duration,
+               "songalbum",
+               &album,
+               "songartist",
+               &artist,
+               "bitrate",
+               &bitrate,
+               "duration",
+               &duration,
+               "songgenre",
+               &genre,
+               "title",
+               &title,
+               "track",
+               &track,
+               "location",
+               &url,
+               "has-video",
+               &has_video,
                 NULL);
 
   id_s = g_strdup_printf ("%u", GPOINTER_TO_UINT (id));
@@ -262,8 +277,8 @@ add_media_from_service (gpointer id,
     media = grl_media_audio_new ();
   }
 
-  grl_media_set_id       (media, id_s);
-  grl_media_set_duration (media, duration);
+  grl_media_set_id           (media, id_s);
+  grl_media_set_duration     (media, duration);
 
   if (title) {
     grl_media_set_title (media, title);
@@ -275,6 +290,25 @@ add_media_from_service (gpointer id,
     grl_media_set_url (media, url);
   }
 
+  if (has_video == FALSE) {
+    GrlMediaAudio *media_audio = GRL_MEDIA_AUDIO (media);
+
+    grl_media_audio_set_bitrate      (media_audio, bitrate);
+    grl_media_audio_set_track_number (media_audio, track);
+
+    if (album) {
+      grl_media_audio_set_album (media_audio, album);
+    }
+
+    if (artist) {
+      grl_media_audio_set_artist (media_audio, artist);
+    }
+
+    if (genre) {
+      grl_media_audio_set_genre (media_audio, genre);
+    }
+  }
+
   g_free (id_s);
 
   cb->callback (cb->source,
@@ -417,9 +451,14 @@ grl_dmap_source_supported_keys (GrlSource *source)
   GRL_DEBUG (__func__);
 
   if (!keys) {
-    keys = grl_metadata_key_list_new (GRL_METADATA_KEY_ID,
+    keys = grl_metadata_key_list_new (GRL_METADATA_KEY_ALBUM,
+                                      GRL_METADATA_KEY_ARTIST,
+                                      GRL_METADATA_KEY_BITRATE,
                                       GRL_METADATA_KEY_DURATION,
+                                      GRL_METADATA_KEY_GENRE,
+                                      GRL_METADATA_KEY_ID,
                                       GRL_METADATA_KEY_TITLE,
+                                      GRL_METADATA_KEY_TRACK_NUMBER,
                                       GRL_METADATA_KEY_URL,
                                       NULL);
   }


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