Skip to content

Commit 675f6b2

Browse files
committed
clapper: discoverer: Skip items that already have tags
When tags are populated elsewhere, do not run discovery on them again. It is possible they were discovered in more efficient maner (e.g. from playlist data itself). This avoid us downloading each media item separately after all playlist items are queued.
1 parent e7359c8 commit 675f6b2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/lib/clapper/features/discoverer/clapper-discoverer.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
*/
4040

4141
#include <gst/gst.h>
42+
#include <gst/tag/tag.h>
4243
#include <gst/pbutils/pbutils.h>
4344

4445
#include "clapper-discoverer.h"
@@ -128,8 +129,9 @@ _run_discovery (ClapperDiscoverer *self)
128129
ClapperMediaItem *item;
129130
ClapperQueue *queue;
130131
ClapperDiscovererDiscoveryMode discovery_mode;
132+
GstTagList *tags;
131133
const gchar *uri;
132-
gboolean success = FALSE;
134+
gboolean empty_tags, success = FALSE;
133135

134136
if (self->pending_items->len == 0) {
135137
GST_DEBUG_OBJECT (self, "No more pending items");
@@ -157,6 +159,16 @@ _run_discovery (ClapperDiscoverer *self)
157159
goto finish;
158160
}
159161

162+
tags = clapper_media_item_get_tags (item);
163+
empty_tags = gst_tag_list_is_empty (tags);
164+
gst_tag_list_unref (tags);
165+
166+
if (!empty_tags) {
167+
GST_DEBUG_OBJECT (self, "Queued %" GST_PTR_FORMAT
168+
" already has tags, ignoring discovery", item);
169+
goto finish;
170+
}
171+
160172
uri = clapper_media_item_get_uri (item);
161173
GST_DEBUG_OBJECT (self, "Starting discovery of %"
162174
GST_PTR_FORMAT "(%s)", item, uri);

0 commit comments

Comments
 (0)