Commit ecb703e4 authored by Debarshi Ray's avatar Debarshi Ray Committed by Martyn Russell

Revert "Always guarantee metadata, remove --enable-guarantee-metadata option"

This reverts commit 898ac3ca.

Conflicts:
	tests/libtracker-extract/tracker-guarantee-test.c

https://bugzilla.gnome.org/show_bug.cgi?id=733536
parent 8d148676
......@@ -2545,6 +2545,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
####################################################################
......@@ -2823,6 +2841,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)
"
......
......@@ -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;
}
......@@ -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 }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment