[grilo-plugins] tracker: metadata should not resolve media coming from tracker
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] tracker: metadata should not resolve media coming from tracker
- Date: Mon, 28 Mar 2011 16:18:07 +0000 (UTC)
commit 5aec4f22278ee32933a8e1faf2db2337e5fed2ca
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Thu Mar 24 09:17:49 2011 +0000
tracker: metadata should not resolve media coming from tracker
This is mainly an optimization: we do not want tracker resolving keys for
medias coming from tracker.
The rationale is that we have metadata() precisily to do it: invoking resolve()
after invoking metadata() for Tracker media is useless, as if the key could not
be resolved with metadata() it will not be resolved with resolve() (both
functions are sharing the same code).
This fixes https://bugzilla.gnome.org/show_bug.cgi?id=645523
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
src/media/tracker/grl-tracker-media.c | 31 ++++++++++++++++++++++++++++++
src/media/tracker/grl-tracker-media.h | 2 +
src/media/tracker/grl-tracker-metadata.c | 4 +++
3 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/media/tracker/grl-tracker-media.c b/src/media/tracker/grl-tracker-media.c
index e5ccfff..0a3e09e 100644
--- a/src/media/tracker/grl-tracker-media.c
+++ b/src/media/tracker/grl-tracker-media.c
@@ -271,6 +271,37 @@ grl_tracker_media_find (const gchar *id)
id);
}
+static gboolean
+match_plugin_id (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ if (g_strcmp0 (grl_metadata_source_get_id (GRL_METADATA_SOURCE (value)),
+ (gchar *) user_data) == 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* Search for registered plugin with @id */
+GrlTrackerMedia *
+grl_tracker_media_find_source (const gchar *id)
+{
+ GrlTrackerMedia *source;
+
+ source = g_hash_table_find (grl_tracker_media_sources,
+ match_plugin_id,
+ (gpointer) id);
+ if (source) {
+ return source;
+ }
+
+ return g_hash_table_find (grl_tracker_media_sources_modified,
+ match_plugin_id,
+ (gpointer) id);
+}
+
static void
tracker_get_datasource_cb (GObject *object,
GAsyncResult *result,
diff --git a/src/media/tracker/grl-tracker-media.h b/src/media/tracker/grl-tracker-media.h
index a015a2a..0ca6a9d 100644
--- a/src/media/tracker/grl-tracker-media.h
+++ b/src/media/tracker/grl-tracker-media.h
@@ -89,4 +89,6 @@ void grl_tracker_del_source (GrlTrackerMedia *source);
GrlTrackerMedia *grl_tracker_media_find (const gchar *id);
+GrlTrackerMedia *grl_tracker_media_find_source (const gchar *id);
+
#endif /* _GRL_TRACKER_MEDIA_H_ */
diff --git a/src/media/tracker/grl-tracker-metadata.c b/src/media/tracker/grl-tracker-metadata.c
index 8f09ad0..22aba1a 100644
--- a/src/media/tracker/grl-tracker-metadata.c
+++ b/src/media/tracker/grl-tracker-metadata.c
@@ -26,6 +26,7 @@
#include "grl-tracker-metadata.h"
#include "grl-tracker-utils.h"
+#include "grl-tracker-media.h"
/* --------- Logging -------- */
@@ -298,6 +299,9 @@ grl_tracker_metadata_may_resolve (GrlMetadataSource *source,
{
GRL_IDEBUG ("%s: key=%s", __FUNCTION__, g_param_spec_get_name (key_id));
+ if (media && grl_tracker_media_find_source (grl_media_get_source (media)))
+ return FALSE;
+
if (!grl_tracker_key_is_supported (key_id))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]