[grilo] source: Warn against broken media boxes



commit 0b7ed08f0a4cb7449d0c63ab5a4ec431640c98b4
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Nov 25 12:28:50 2015 +0100

    source: Warn against broken media boxes
    
    All media boxes should have IDs for us to be able to serialise, or
    deserialise it, and, for example, browse the sub-boxes in some sources
    with grl-launch.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758654

 src/grl-source.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-source.c b/src/grl-source.c
index 3fd9496..171975d 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -2282,6 +2282,22 @@ auto_split_run_next_chunk (struct BrowseRelayCb *brc)
 }
 
 static void
+warn_if_no_id (GrlMedia *media,
+               GrlSource *source)
+{
+  const char *id;
+
+  if (media == NULL || !GRL_IS_MEDIA_BOX (media))
+    return;
+
+  id = grl_media_get_id (media);
+  if (id == NULL || *id == '\0')
+    GRL_WARNING ("Media box is not browsable, has no ID: %s (source: %s)",
+                 grl_media_get_title (media),
+                 grl_source_get_id (source));
+}
+
+static void
 browse_result_relay_cb (GrlSource *source,
                         guint operation_id,
                         GrlMedia *media,
@@ -2348,6 +2364,7 @@ browse_result_relay_cb (GrlSource *source,
       (GRL_RESOLVE_FULL | GRL_RESOLVE_IDLE_RELAY)) {
     queue_add_media (brc, media, remaining, error);
   } else {
+    warn_if_no_id (media, source);
     brc->user_callback (source, operation_id, media, remaining,
                         brc->user_data, error);
   }


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