[grilo-plugins] tracker: Relax tracker version requirement



commit 48e7dd1dfefef29d1cc56d18725a0b71a69dedc1
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Thu Mar 31 16:52:33 2011 +0200

    tracker: Relax tracker version requirement
    
    Tracker 0.10.5 defines nfo:lastPlayedPosition.
    
    But we can live with older versions if we ignore that key.
    
    So let's use it only if we have such Tracker version.
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 configure.ac                              |   21 +++++++++++++++------
 src/media/tracker/grl-tracker-media-api.c |    6 ++++++
 src/media/tracker/grl-tracker-utils.c     |    6 ++++++
 3 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 363f13c..0c732e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,11 +125,20 @@ AC_CHECK_HEADER([gcrypt.h], HAVE_GCRYPT=yes, HAVE_GCRYPT=no)
 
 PKG_CHECK_MODULES(GTHREAD, gthread-2.0, HAVE_GTHREAD=yes, HAVE_GTHREAD=no)
 
-REQUIRED_TRACKER_VERSION=0.10.5
-PKG_CHECK_MODULES(TRACKER_SPARQL,
-                  tracker-sparql-0.10 >= ${REQUIRED_TRACKER_VERSION},
-                  HAVE_TRACKER_SPARQL=yes,
-                  HAVE_TRACKER_SPARQL=no)
+PKG_CHECK_MODULES(TRACKER_SPARQL, tracker-sparql-0.10,
+                                  HAVE_TRACKER_SPARQL=yes,
+                                  [PKG_CHECK_MODULES(TRACKER_SPARQL, tracker-sparql-0.9,
+                                                                     HAVE_TRACKER_SPARQL=yes,
+                                                                     HAVE_TRACKER_SPARQL=no)])
+
+PKG_CHECK_MODULES(TRACKER_0_10_5,
+        tracker-sparql-0.10 >= 0.10.5,
+        TRACKER_0_10_5=yes,
+        [AC_MSG_WARN([nfo:lastPlayedPosition not defined])])
+
+if test "x$TRACKER_0_10_5" = "xyes"; then
+   AC_DEFINE_UNQUOTED([TRACKER_0_10_5], [1], [Tracker >= 0.10.5])
+fi
 
 PKG_CHECK_MODULES(GLIB_2_26, glib-2.0 >= 2.26.0,
                              HAVE_GLIB_2_26=yes,
@@ -669,7 +678,7 @@ AC_ARG_ENABLE(tracker,
                 case "$enableval" in
                      yes)
                         if test "x$HAVE_TRACKER_SPARQL" = "xno"; then
-                           AC_MSG_ERROR([tracker-sparql ${REQUIRED_TRACKER_VERSION} not found, install it or use --disable-tracker])
+                           AC_MSG_ERROR([tracker-sparql-0.9 not found, install it or use --disable-tracker])
                         fi
                         if test "x$HAVE_GLIB_2_26" = "xno"; then
                            AC_MSG_ERROR([glib-2.26.0 or above not found, install it or use --disable-tracker])
diff --git a/src/media/tracker/grl-tracker-media-api.c b/src/media/tracker/grl-tracker-media-api.c
index 9224163..cb455f3 100644
--- a/src/media/tracker/grl-tracker-media-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -22,6 +22,10 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <gio/gio.h>
 #include <tracker-sparql.h>
 
@@ -474,7 +478,9 @@ grl_tracker_media_writable_keys (GrlMetadataSource *source)
   if (!keys) {
     keys = grl_metadata_key_list_new (GRL_METADATA_KEY_PLAY_COUNT,
                                       GRL_METADATA_KEY_LAST_PLAYED,
+#ifdef TRACKER_0_10_5
                                       GRL_METADATA_KEY_LAST_POSITION,
+#endif
                                       NULL);
   }
   return keys;
diff --git a/src/media/tracker/grl-tracker-utils.c b/src/media/tracker/grl-tracker-utils.c
index 974b81b..de10452 100644
--- a/src/media/tracker/grl-tracker-utils.c
+++ b/src/media/tracker/grl-tracker-utils.c
@@ -22,6 +22,10 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "grl-tracker-utils.h"
 
 /**/
@@ -275,10 +279,12 @@ grl_tracker_setup_key_mappings (void)
                       "nie:contentAccessed(?urn)",
                       "media");
 
+#ifdef TRACKER_0_10_5
   insert_key_mapping (GRL_METADATA_KEY_LAST_POSITION,
                       "nfo:lastPlayedPosition",
                       "nfo:lastPlayedPosition(?urn)",
                       "media");
+#endif
 
   if (grl_tracker_upnp_present) {
     insert_key_mapping (GRL_METADATA_KEY_THUMBNAIL,



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