[tracker/tracker-1.2] Revert "Always guarantee metadata, remove --enable-guarantee-metadata option"
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-1.2] Revert "Always guarantee metadata, remove --enable-guarantee-metadata option"
- Date: Wed, 10 Dec 2014 11:29:02 +0000 (UTC)
commit 44e85f834d21fb9be2b3c3f355ba497d87e19b74
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Nov 20 14:59:41 2014 +0100
Revert "Always guarantee metadata, remove --enable-guarantee-metadata option"
This reverts commit 898ac3ca17afa5d9fb382656e7e4ba4ff4b6ef39.
Conflicts:
tests/libtracker-extract/tracker-guarantee-test.c
https://bugzilla.gnome.org/show_bug.cgi?id=733536
configure.ac | 19 ++++++++++++++++++
src/libtracker-extract/tracker-guarantee.c | 22 +++++++++++++++++++++
tests/libtracker-extract/tracker-guarantee-test.c | 8 +++++++
3 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a0ee334..48a814f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2493,6 +2493,24 @@ fi
AM_CONDITIONAL(HAVE_TOTEM_PL_PARSER, test "x$have_playlist" = "xyes")
+#####################################################################
+# Check for tracker-extract: Guarantee existence of certain metadata
+#####################################################################
+
+# Currently guarantees (for extraction):
+# - nie:title for music and video files
+# - nie:contentCreated for music, video and image files
+
+AC_ARG_ENABLE(guarantee-metadata,
+ AS_HELP_STRING([--enable-guarantee-metadata],
+ [enable guaranteed existence of some metadata, e.g. nie:title from files
[[default=no]]]),
+ [enable_guarantee_metadata=$enableval],
+ [enable_guarantee_metadata=no])
+
+if test "x$enable_guarantee_metadata" != "xno"; then
+ AC_DEFINE(GUARANTEE_METADATA, 1, [Guarantee existence of some metadata])
+fi
+
####################################################################
# Check if we should use initctl or sysvinit
####################################################################
@@ -2774,6 +2792,7 @@ Frameworks / Options:
Support GNOME's Nautilus $have_tracker_nautilus_extension
($tracker_nautilus_extension_install_dir)
Support Maemo $enable_maemo
Support libmeegotouch $have_meegotouch
+ Support Guaranteed Metadata $enable_guarantee_metadata (e.g. guess nie:title from files)
"
diff --git a/src/libtracker-extract/tracker-guarantee.c b/src/libtracker-extract/tracker-guarantee.c
index 077342d..d7409e5 100644
--- a/src/libtracker-extract/tracker-guarantee.c
+++ b/src/libtracker-extract/tracker-guarantee.c
@@ -28,6 +28,8 @@
#include "tracker-guarantee.h"
+#ifdef GUARANTEE_METADATA
+
static gchar *
get_title_from_file (const gchar *uri)
{
@@ -66,6 +68,8 @@ get_date_from_file_mtime (const gchar *uri)
return date;
}
+#endif /* GUARANTEE_METADATA */
+
/**
* tracker_guarantee_title_from_file:
* @metadata: the metadata object to insert the data into
@@ -94,6 +98,7 @@ tracker_guarantee_title_from_file (TrackerSparqlBuilder *metadata,
const gchar *uri,
gchar **p_new_value)
{
+#ifdef GUARANTEE_METADATA
g_return_val_if_fail (metadata != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
@@ -118,6 +123,16 @@ tracker_guarantee_title_from_file (TrackerSparqlBuilder *metadata,
g_free (value);
}
}
+#else /* GUARANTEE_METADATA */
+ if (current_value && *current_value != '\0') {
+ tracker_sparql_builder_predicate (metadata, key);
+ tracker_sparql_builder_object_unvalidated (metadata, current_value);
+
+ if (p_new_value != NULL) {
+ *p_new_value = g_strdup (current_value);
+ }
+ }
+#endif /* GUARANTEE_METADATA */
return TRUE;
}
@@ -146,6 +161,7 @@ tracker_guarantee_date_from_file_mtime (TrackerSparqlBuilder *metadata,
const gchar *current_value,
const gchar *uri)
{
+#ifdef GUARANTEE_METADATA
g_return_val_if_fail (metadata != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
@@ -161,6 +177,12 @@ tracker_guarantee_date_from_file_mtime (TrackerSparqlBuilder *metadata,
tracker_sparql_builder_object_unvalidated (metadata, value);
g_free (value);
}
+#else /* GUARANTEE_METADATA */
+ if (current_value && *current_value != '\0') {
+ tracker_sparql_builder_predicate (metadata, key);
+ tracker_sparql_builder_object_unvalidated (metadata, current_value);
+ }
+#endif /* GUARANTEE_METADATA */
return TRUE;
}
diff --git a/tests/libtracker-extract/tracker-guarantee-test.c
b/tests/libtracker-extract/tracker-guarantee-test.c
index 00fa089..3495c55 100644
--- a/tests/libtracker-extract/tracker-guarantee-test.c
+++ b/tests/libtracker-extract/tracker-guarantee-test.c
@@ -35,18 +35,26 @@ typedef struct {
TestInfo title_tests [] = {
{ "normal-extraction", "file:///a/b/a_video_with_metadata.avi", "extracted title", "extracted title"
},
+
+#ifdef GUARANTEE_METADATA
{ "empty-extraction", "file:///a/b/a_video_with_no_metadata.avi", NULL, "a video with no metadata" },
{ "underscore-separators", "file:///a/b/a_video_with_no_metadata.avi", "", "a video with no metadata"
},
{ "dot-separators", "file:///a/b/a.video.with.no.metadata.avi", NULL, "a.video.with.no.metadata" },
{ "no-extension", "file:///a/b/a video without extension", NULL, "a video without extension" },
{ "hidden-files", "file:///a/b/.hidden_file", NULL, "hidden file" },
+#endif
+
{ NULL, NULL, NULL }
};
TestInfo date_tests [] = {
{ "date-normal", "file:///does/not/matter/here", NULL, "2011-10-10T12:13:14Z0300" },
+
+#ifdef GUARANTEE_METADATA
{ "date-is-null", NULL, NULL, NULL },
{ "date-is-empty-string", NULL, NULL, NULL },
+#endif
+
{ NULL, NULL, NULL }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]