[libdmapsharing/gobject-introspection] Finished fixing test-dmap-client printing of DPAP records



commit d0b3fc060032e20793061131aeea9f4d95baced8
Author: W. Michael Petullo <mike flyn org>
Date:   Wed Jun 25 23:14:18 2014 -0400

    Finished fixing test-dmap-client printing of DPAP records
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 tests/test-dmap-client.c |   50 ++++++++++++++++++++++++++++++---------------
 1 files changed, 33 insertions(+), 17 deletions(-)
---
diff --git a/tests/test-dmap-client.c b/tests/test-dmap-client.c
index 4ffbe94..d4dae29 100644
--- a/tests/test-dmap-client.c
+++ b/tests/test-dmap-client.c
@@ -39,23 +39,39 @@ static guint conn_type = DAAP;
 static void
 print_record (guint id, DMAPRecord *record, gpointer user_data)
 {
-       gboolean has_video = FALSE;
-       gchar   *artist = NULL, *title = NULL, *format = NULL, *filename = NULL;
-
-       g_object_get (record,
-                    "has-video", &has_video,
-                    "songartist", &artist,
-                    "title",  &title,
-                    "format",  &format,
-                    "filename",  &filename,
-                     NULL);
-
-       g_print ("%d: %s %s %s %s (has video: %s)\n", id, artist, title, format, filename, has_video ? "Y" : 
"N");
-
-       g_free (artist);
-       g_free (title);
-       g_free (format);
-       g_free (filename);
+       if  (IS_DAAP_RECORD (record)) {
+               gboolean has_video = FALSE;
+               gchar   *artist = NULL, *title = NULL, *format = NULL, *filename = NULL;
+
+               g_object_get (record,
+                            "has-video", &has_video,
+                            "songartist", &artist,
+                            "title",  &title,
+                            "format",  &format,
+                            "filename",  &filename,
+                             NULL);
+
+               g_print ("%d: %s %s %s %s (has video: %s)\n", id, artist, title, format, filename, has_video 
? "Y" : "N");
+
+               g_free (artist);
+               g_free (title);
+               g_free (format);
+               g_free (filename);
+       } else if (IS_DPAP_RECORD (record)) {
+               gchar   *format = NULL, *filename = NULL;
+
+               g_object_get (record,
+                            "format",  &format,
+                            "filename",  &filename,
+                             NULL);
+
+               g_print ("%d: %s %s\n", id, format, filename);
+
+               g_free (format);
+               g_free (filename);
+       } else {
+               g_error ("Unknown record type");
+       }
 }
 
 static void


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