summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2015-11-25 12:28:50 +0100
committerBastien Nocera <hadess@hadess.net>2015-12-14 11:39:50 +0100
commit0b7ed08f0a4cb7449d0c63ab5a4ec431640c98b4 (patch)
tree8fe67921a4523d74a125f4f8c7c0e037b2a30dfd
parent3f4ec06aacd6dcae1a10c1d5f01ebcbc31f62137 (diff)
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
-rw-r--r--src/grl-source.c17
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);
}