Commit 898ac3ca authored by Sam Thursfield's avatar Sam Thursfield Committed by Sam Thursfield

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

The --enable-guarantee-metadata flag ensures that nie:title and
nie:contentCreated will always be set for a given file, even if they
need to be guessed based on the filename and mtime.

It was previously disabled by default, although the functional tests
rely on it being enabled.

There should be no harm in making this behaviour the default, and
removing the option. If this turns out to have unintended consequences,
we should either fix the code in question, or remove it completely.

https://bugzilla.gnome.org/show_bug.cgi?id=733536
parent 91162487
......@@ -2471,24 +2471,6 @@ 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
####################################################################
......@@ -2770,7 +2752,6 @@ 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,8 +28,6 @@
#include "tracker-guarantee.h"
#ifdef GUARANTEE_METADATA
static gchar *
get_title_from_file (const gchar *uri)
{
......@@ -68,8 +66,6 @@ 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
......@@ -98,7 +94,6 @@ 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);
......@@ -123,16 +118,6 @@ 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;
}
......@@ -161,7 +146,6 @@ 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);
......@@ -177,12 +161,6 @@ 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;
}
......@@ -30,13 +30,11 @@ typedef struct {
TestCase test_cases_title [] = {
{ "file:///a/b/a_video_with_metadata.avi", "extracted title", "extracted title" },
#ifdef GUARANTEE_METADATA
{ "file:///a/b/a_video_with_no_metadata.avi", NULL, "a video with no metadata" },
{ "file:///a/b/a_video_with_no_metadata.avi", "", "a video with no metadata" },
{ "file:///a/b/a.video.with.no.metadata.avi", NULL, "a.video.with.no.metadata" },
{ "file:///a/b/a video without extension", NULL, "a video without extension" },
{ "file:///a/b/.hidden_file", NULL, "hidden file" },
#endif
{ NULL, NULL, NULL}
};
......@@ -110,33 +108,25 @@ test_guarantee_title (void)
test_cases_title[i].expected_title);
}
#ifdef GUARANTEE_METADATA
g_print ("%d test cases (guarantee metadata enabled) ", i);
#else
g_print ("%d test cases (guarantee metadata disabled) ", i);
#endif
}
static void
test_guarantee_date (void)
{
#ifdef GUARANTEE_METADATA
GFile *f;
gchar *uri;
#endif
internal_test_date ("file:///does/not/matter/here", "2011-10-10T12:13:14Z0300");
#ifdef GUARANTEE_METADATA
f = g_file_new_for_path (TOP_SRCDIR "/tests/libtracker-extract/guarantee-mtime-test.txt");
uri = g_file_get_uri (f);
internal_test_date (uri, NULL);
internal_test_date (uri, "");
g_free (uri);
g_object_unref (f);
#endif
}
......
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