[grilo-plugins] tracker: rewrite resolving functions
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] tracker: rewrite resolving functions
- Date: Thu, 17 Mar 2011 20:37:23 +0000 (UTC)
commit 4b6c12f4a49a750cefaa67ac6ccaae074b07c3bd
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date: Wed Mar 16 16:29:59 2011 +0000
tracker: rewrite resolving functions
may_resolve: handle missing keys
resolve: more debug/assert
Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
src/media/tracker/grl-tracker-metadata.c | 39 ++++++++++++++++++-----------
1 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/src/media/tracker/grl-tracker-metadata.c b/src/media/tracker/grl-tracker-metadata.c
index 2c5136e..08eaee0 100644
--- a/src/media/tracker/grl-tracker-metadata.c
+++ b/src/media/tracker/grl-tracker-metadata.c
@@ -46,7 +46,7 @@ GRL_LOG_DOMAIN_STATIC(tracker_metadata_result_log_domain);
/* ------- Definitions ------- */
-#define TRACKER_RESOLVE_REQUEST \
+#define TRACKER_RESOLVE_URL_REQUEST \
"SELECT %s " \
"WHERE " \
"{ " \
@@ -54,6 +54,14 @@ GRL_LOG_DOMAIN_STATIC(tracker_metadata_result_log_domain);
"?urn nie:url \"%s\" " \
"}"
+#define TRACKER_RESOLVE_ID_REQUEST \
+ "SELECT %s " \
+ "WHERE " \
+ "{ " \
+ "?urn a nie:DataObject . " \
+ "FILTER(tracker:id(?urn) = %i) " \
+ "}"
+
/**/
#define GRL_TRACKER_METADATA_GET_PRIVATE(object) \
@@ -286,18 +294,16 @@ grl_tracker_metadata_may_resolve (GrlMetadataSource *source,
GrlKeyID key_id,
GList **missing_keys)
{
- const gchar *url;
+ GRL_IDEBUG ("%s: key=%s", __FUNCTION__, g_param_spec_get_name (key_id));
- if (media) {
- url = grl_media_get_url (media);
+ if (!grl_tracker_key_is_supported (key_id))
+ return FALSE;
- if (url && grl_tracker_key_is_supported (key_id)) {
- return TRUE;
- }
- } else {
- if (grl_tracker_key_is_supported (key_id))
+ if (media && grl_media_get_url (media))
return TRUE;
- }
+
+ if (missing_keys)
+ *missing_keys = g_list_append (*missing_keys, GRL_METADATA_KEY_URL);
return FALSE;
}
@@ -313,10 +319,15 @@ grl_tracker_metadata_resolve (GrlMetadataSource *source,
GRL_IDEBUG ("%s", __FUNCTION__);
- g_return_if_fail (url != NULL);
+ if (url) {
+ sparql_select = grl_tracker_media_get_select_string (rs->keys);
+ sparql_final = g_strdup_printf (TRACKER_RESOLVE_URL_REQUEST,
+ sparql_select, url);
+ } else {
+ g_return_if_reached ();
+ }
- sparql_select = grl_tracker_media_get_select_string (rs->keys);
- sparql_final = g_strdup_printf (TRACKER_RESOLVE_REQUEST, sparql_select, url);
+ GRL_IDEBUG ("request: '%s'", sparql_final);
tracker_sparql_connection_query_async (priv->tracker_connection,
sparql_final,
@@ -324,8 +335,6 @@ grl_tracker_metadata_resolve (GrlMetadataSource *source,
(GAsyncReadyCallback) tracker_resolve_cb,
rs);
- GRL_IDEBUG ("request: '%s'", sparql_final);
-
g_free (sparql_select);
g_free (sparql_final);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]