[tracker/extractor-dev: 15/17] libtracker-extract: Code clean up
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/extractor-dev: 15/17] libtracker-extract: Code clean up
- Date: Tue, 9 Mar 2010 17:46:42 +0000 (UTC)
commit 2bb3b104ceb7cc3bce1f1466a2e627170181b3ba
Author: Martyn Russell <martyn lanedo com>
Date: Tue Mar 9 14:56:30 2010 +0000
libtracker-extract: Code clean up
This involves:
- Renaming all tracker_extract_* APIs to tracker_ APIs. We don't do
this everywhere and it was completely inconsistent and only for
utilities. The structures were not using the same naming either.
- Fixed some compiler warnings (for vorbis)
- Fixed the includes in libtracker-extract source files. Many were
not needed.
.../libtracker-extract-sections.txt | 16 ++++-----
.../libtracker-extract/tracker-extract-mockup.c | 4 +-
src/libtracker-extract/tracker-data.h | 6 ++--
src/libtracker-extract/tracker-exif.c | 19 ++++------
src/libtracker-extract/tracker-exif.h | 8 ++--
src/libtracker-extract/tracker-iptc.c | 18 ++++------
src/libtracker-extract/tracker-iptc.h | 8 ++--
src/libtracker-extract/tracker-utils.c | 39 ++++++++------------
src/libtracker-extract/tracker-utils.h | 27 ++++++--------
src/libtracker-extract/tracker-xmp.c | 30 ++++++---------
src/libtracker-extract/tracker-xmp.h | 16 ++++-----
src/tracker-extract/tracker-extract-flac.c | 2 +-
src/tracker-extract/tracker-extract-jpeg.c | 24 ++++++------
src/tracker-extract/tracker-extract-mp3.c | 12 +++---
src/tracker-extract/tracker-extract-msoffice.c | 18 +++++-----
src/tracker-extract/tracker-extract-oasis.c | 4 +-
src/tracker-extract/tracker-extract-pdf.c | 4 +-
src/tracker-extract/tracker-extract-png.c | 2 +-
src/tracker-extract/tracker-extract-ps.c | 8 ++--
src/tracker-extract/tracker-extract-tiff.c | 20 +++++-----
src/tracker-extract/tracker-extract-vorbis.c | 4 +-
src/tracker-extract/tracker-extract-xmp.c | 10 +++---
tests/libtracker-extract/tracker-utils-test.c | 14 ++++----
23 files changed, 141 insertions(+), 172 deletions(-)
---
diff --git a/docs/reference/libtracker-extract/libtracker-extract-sections.txt b/docs/reference/libtracker-extract/libtracker-extract-sections.txt
index 3229535..ad1e45f 100644
--- a/docs/reference/libtracker-extract/libtracker-extract-sections.txt
+++ b/docs/reference/libtracker-extract/libtracker-extract-sections.txt
@@ -1,14 +1,14 @@
<SECTION>
<FILE>tracker-xmp</FILE>
TrackerXmpData
-tracker_extract_xmp_read
-tracker_extract_xmp_apply
+tracker_xmp_read
+tracker_xmp_apply
</SECTION>
<SECTION>
<FILE>tracker-iptc</FILE>
TrackerIptcData
-tracker_extract_iptc_read
+tracker_iptc_read
</SECTION>
<SECTION>
@@ -17,18 +17,16 @@ TrackerExtractMimeFunc
TrackerExtractDataFunc
TrackerExtractData
tracker_extract_get_data
-tracker_extract_coalesce
-tracker_extract_date_format_to_iso8601
-tracker_extract_guess_date
-tracker_extract_merge
-tracker_extract_text_normalize
tracker_coalesce
tracker_merge
+tracker_text_normalize
+tracker_date_format_to_iso8601
+tracker_date_guess
</SECTION>
<SECTION>
<FILE>tracker-exif</FILE>
TrackerExifData
-tracker_extract_exif_read
+tracker_exif_read
</SECTION>
diff --git a/examples/libtracker-extract/tracker-extract-mockup.c b/examples/libtracker-extract/tracker-extract-mockup.c
index be1f2a4..7063a51 100644
--- a/examples/libtracker-extract/tracker-extract-mockup.c
+++ b/examples/libtracker-extract/tracker-extract-mockup.c
@@ -134,8 +134,8 @@ extract_mockup (const gchar *uri,
fclose (f);
/* TODO: Make sure we coalesce duplicate values */
- title = tracker_extract_coalesce (4, title_tagv1, title_tagv2, title_tagv3, title_unknown);
- lyricist = tracker_extract_coalesce (2, lyricist_tagv2, lyricist_unknown);
+ title = tracker_coalesce (4, title_tagv1, title_tagv2, title_tagv3, title_unknown);
+ lyricist = tracker_coalesce (2, lyricist_tagv2, lyricist_unknown);
performer = g_strdup ("Stone Gods");
composer = NULL;
diff --git a/src/libtracker-extract/tracker-data.h b/src/libtracker-extract/tracker-data.h
index c536907..3c9dcd9 100644
--- a/src/libtracker-extract/tracker-data.h
+++ b/src/libtracker-extract/tracker-data.h
@@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __LIBTRACKER_EXTRACT_EXTRACTOR_H__
-#define __LIBTRACKER_EXTRACT_EXTRACTOR_H__
+#ifndef __LIBTRACKER_EXTRACT_DATA_H__
+#define __LIBTRACKER_EXTRACT_DATA_H__
#if !defined (__LIBTRACKER_EXTRACT_INSIDE__) && !defined (TRACKER_COMPILATION)
#error "only <libtracker-extract/tracker-extract.h> must be included directly."
@@ -181,4 +181,4 @@ TrackerExtractData *tracker_extract_get_data (void);
G_END_DECLS
-#endif /* __LIBTRACKER_EXTRACT_EXTRACTOR_H__ */
+#endif /* __LIBTRACKER_EXTRACT_DATA_H__ */
diff --git a/src/libtracker-extract/tracker-exif.c b/src/libtracker-extract/tracker-exif.c
index 675750d..cca9fe5 100644
--- a/src/libtracker-extract/tracker-exif.c
+++ b/src/libtracker-extract/tracker-exif.c
@@ -19,16 +19,11 @@
#include "config.h"
-#include <locale.h>
#include <string.h>
#include <ctype.h>
-#include <glib.h>
-
-#include <libtracker-common/tracker-date-time.h>
-#include <libtracker-common/tracker-utils.h>
-#include <libtracker-extract/tracker-utils.h>
#include "tracker-exif.h"
+#include "tracker-utils.h"
#ifdef HAVE_LIBEXIF
@@ -94,7 +89,7 @@ get_date (ExifData *exif,
exif_entry_get_value (entry, buf, 1024);
/* From: ex; date "2007:04:15 15:35:58"
* To : ex. "2007-04-15T17:35:58+0200 where +0200 is localtime */
- return tracker_extract_date_format_to_iso8601 (buf, EXIF_DATE_FORMAT);
+ return tracker_date_format_to_iso8601 (buf, EXIF_DATE_FORMAT);
}
return NULL;
@@ -315,7 +310,7 @@ get_value (ExifData *exif,
#endif /* HAVE_LIBEXIF */
/**
- * tracker_extract_exif_read:
+ * tracker_exif_read:
* @buffer: a chunk of data with exif data in it.
* @len: the size of @buffer.
* @uri: the URI this is related to.
@@ -331,10 +326,10 @@ get_value (ExifData *exif,
* Since: 0.8
**/
gboolean
-tracker_extract_exif_read (const unsigned char *buffer,
- size_t len,
- const gchar *uri,
- TrackerExifData *data)
+tracker_exif_read (const unsigned char *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerExifData *data)
{
#ifdef HAVE_LIBEXIF
ExifData *exif;
diff --git a/src/libtracker-extract/tracker-exif.h b/src/libtracker-extract/tracker-exif.h
index a97a557..6bbed33 100644
--- a/src/libtracker-extract/tracker-exif.h
+++ b/src/libtracker-extract/tracker-exif.h
@@ -52,10 +52,10 @@ typedef struct {
gchar *software;
} TrackerExifData;
-gboolean tracker_extract_exif_read (const unsigned char *buffer,
- size_t len,
- const gchar *uri,
- TrackerExifData *data);
+gboolean tracker_exif_read (const unsigned char *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerExifData *data);
G_END_DECLS
diff --git a/src/libtracker-extract/tracker-iptc.c b/src/libtracker-extract/tracker-iptc.c
index a57d41a..786a194 100644
--- a/src/libtracker-extract/tracker-iptc.c
+++ b/src/libtracker-extract/tracker-iptc.c
@@ -21,12 +21,8 @@
#include <string.h>
-#include <glib.h>
-
-#include <libtracker-common/tracker-date-time.h>
-#include <libtracker-extract/tracker-utils.h>
-
#include "tracker-iptc.h"
+#include "tracker-utils.h"
#ifdef HAVE_LIBIPTCDATA
@@ -102,7 +98,7 @@ foreach_dataset (IptcDataSet *dataset,
iptc_dataset_get_as_str (dataset, mbuffer, 1024);
/* From: ex; date "2007:04:15 15:35:58"
* To : ex. "2007-04-15T17:35:58+0200 where +0200 is localtime */
- data->date_created = tracker_extract_date_format_to_iso8601 (mbuffer, IPTC_DATE_FORMAT);
+ data->date_created = tracker_date_format_to_iso8601 (mbuffer, IPTC_DATE_FORMAT);
}
break;
@@ -184,7 +180,7 @@ foreach_dataset (IptcDataSet *dataset,
#endif /* HAVE_LIBIPTCDATA */
/**
- * tracker_extract_iptc_read:
+ * tracker_iptc_read:
* @buffer: a chunk of data with iptc data in it.
* @len: the size of @buffer.
* @uri: the URI this is related to.
@@ -200,10 +196,10 @@ foreach_dataset (IptcDataSet *dataset,
* Since: 0.8
**/
gboolean
-tracker_extract_iptc_read (const unsigned char *buffer,
- size_t len,
- const gchar *uri,
- TrackerIptcData *data)
+tracker_iptc_read (const unsigned char *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerIptcData *data)
{
#ifdef HAVE_LIBIPTCDATA
IptcData *iptc;
diff --git a/src/libtracker-extract/tracker-iptc.h b/src/libtracker-extract/tracker-iptc.h
index a72c60d..83941d4 100644
--- a/src/libtracker-extract/tracker-iptc.h
+++ b/src/libtracker-extract/tracker-iptc.h
@@ -45,10 +45,10 @@ typedef struct {
gchar *contact;
} TrackerIptcData;
-gboolean tracker_extract_iptc_read (const unsigned char *buffer,
- size_t len,
- const gchar *uri,
- TrackerIptcData *data);
+gboolean tracker_iptc_read (const unsigned char *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerIptcData *data);
G_END_DECLS
diff --git a/src/libtracker-extract/tracker-utils.c b/src/libtracker-extract/tracker-utils.c
index 33fd6f8..fbfbc3e 100644
--- a/src/libtracker-extract/tracker-utils.c
+++ b/src/libtracker-extract/tracker-utils.c
@@ -21,19 +21,13 @@
#define _XOPEN_SOURCE
#include <time.h>
-
-#include <strings.h>
#include <string.h>
-#include <stdlib.h>
-#include <locale.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <libtracker-extract/tracker-utils.h>
#include <libtracker-common/tracker-utils.h>
#include <libtracker-common/tracker-date-time.h>
+#include "tracker-utils.h"
+
#define DATE_FORMAT_ISO8601 "%Y-%m-%dT%H:%M:%S%z"
static const char *months[] = {
@@ -47,8 +41,8 @@ static const char imonths[] = {
};
gchar *
-tracker_extract_coalesce (gint n_values,
- ...)
+tracker_coalesce (gint n_values,
+ ...)
{
va_list args;
gint i;
@@ -73,8 +67,9 @@ tracker_extract_coalesce (gint n_values,
}
gchar *
-tracker_extract_merge (const gchar *delim, gint n_values,
- ...)
+tracker_merge (const gchar *delim,
+ gint n_values,
+ ...)
{
va_list args;
gint i;
@@ -109,9 +104,9 @@ tracker_extract_merge (const gchar *delim, gint n_values,
}
gchar *
-tracker_extract_text_normalize (const gchar *text,
- guint max_words,
- guint *n_words)
+tracker_text_normalize (const gchar *text,
+ guint max_words,
+ guint *n_words)
{
GString *string;
gboolean in_break = TRUE;
@@ -155,8 +150,8 @@ tracker_extract_text_normalize (const gchar *text,
}
gchar *
-tracker_extract_date_format_to_iso8601 (const gchar *date_string,
- const gchar *format)
+tracker_date_format_to_iso8601 (const gchar *date_string,
+ const gchar *format)
{
gchar *result;
struct tm date_tm = { 0 };
@@ -168,18 +163,17 @@ tracker_extract_date_format_to_iso8601 (const gchar *date_string,
return NULL;
}
- result = g_malloc (sizeof (char)*25);
+ result = g_malloc (sizeof (char) * 25);
strftime (result, 25, DATE_FORMAT_ISO8601 , &date_tm);
return result;
}
-
static gboolean
is_int (const gchar *str)
{
- gint i, len;
+ gint i, len;
if (!str || str[0] == '\0') {
return FALSE;
@@ -188,7 +182,7 @@ is_int (const gchar *str)
len = strlen (str);
for (i = 0; i < len; i++) {
- if (!g_ascii_isdigit(str[i])) {
+ if (!g_ascii_isdigit (str[i])) {
return FALSE;
}
}
@@ -210,11 +204,10 @@ parse_month (const gchar *month)
return -1;
}
-
/* Determine date format and convert to ISO 8601 format */
/* FIXME We should handle all the fractions here (see ISO 8601), as well as YYYY:DDD etc */
gchar *
-tracker_extract_guess_date (const gchar *date_string)
+tracker_date_guess (const gchar *date_string)
{
gchar buf[30];
gint len;
diff --git a/src/libtracker-extract/tracker-utils.h b/src/libtracker-extract/tracker-utils.h
index 72dc19b..6dec35c 100644
--- a/src/libtracker-extract/tracker-utils.h
+++ b/src/libtracker-extract/tracker-utils.h
@@ -24,24 +24,19 @@
#error "only <libtracker-extract/tracker-extract.h> must be included directly."
#endif
-/* These are for convenience */
-#define tracker_coalesce tracker_extract_coalesce
-#define tracker_merge tracker_extract_merge
-
G_BEGIN_DECLS
-gchar * tracker_extract_coalesce (gint n_values,
- ...);
-gchar * tracker_extract_merge (const gchar *delim,
- gint n_values,
- ...);
-gchar * tracker_extract_text_normalize (const gchar *text,
- guint max_words,
- guint *n_words);
-
-gchar * tracker_extract_guess_date (const gchar *date_string);
-gchar * tracker_extract_date_format_to_iso8601 (const gchar *date_string,
- const gchar *format);
+gchar *tracker_coalesce (gint n_values,
+ ...);
+gchar *tracker_merge (const gchar *delim,
+ gint n_values,
+ ...);
+gchar *tracker_text_normalize (const gchar *text,
+ guint max_words,
+ guint *n_words);
+gchar *tracker_date_guess (const gchar *date_string);
+gchar *tracker_date_format_to_iso8601 (const gchar *date_string,
+ const gchar *format);
G_END_DECLS
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index b2fdfbf..ca4e4dc 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -20,17 +20,11 @@
#include "config.h"
#include <locale.h>
-#include <string.h>
-#include <glib.h>
-
-#include <libtracker-common/tracker-type-utils.h>
#include <libtracker-common/tracker-utils.h>
-#include <libtracker-common/tracker-ontologies.h>
-
-#include <libtracker-extract/tracker-utils.h>
#include "tracker-xmp.h"
+#include "tracker-utils.h"
#ifdef HAVE_EXEMPI
@@ -267,7 +261,7 @@ iterate_simple (const gchar *uri,
if (!data->title2 && g_ascii_strcasecmp (name, "Title") == 0) {
data->title2 = g_strdup (value);
} else if (g_ascii_strcasecmp (name, "DateTimeOriginal") == 0 && !data->time_original) {
- data->time_original = tracker_extract_guess_date (value);
+ data->time_original = tracker_date_guess (value);
} else if (!data->artist && g_ascii_strcasecmp (name, "Artist") == 0) {
data->artist = g_strdup (value);
/* } else if (g_ascii_strcasecmp (name, "Software") == 0) {
@@ -318,7 +312,7 @@ iterate_simple (const gchar *uri,
} else if (!data->description && g_ascii_strcasecmp (name, "description") == 0) {
data->description = g_strdup (value);
} else if (!data->date && g_ascii_strcasecmp (name, "date") == 0) {
- data->date = tracker_extract_guess_date (value);
+ data->date = tracker_date_guess (value);
} else if (!data->keywords && g_ascii_strcasecmp (name, "keywords") == 0) {
data->keywords = g_strdup (value);
} else if (!data->subject && g_ascii_strcasecmp (name, "subject") == 0) {
@@ -437,7 +431,7 @@ iterate (XmpPtr xmp,
#endif /* HAVE_EXEMPI */
/**
- * tracker_extract_xmp_read:
+ * tracker_xmp_read:
* @buffer: a chunk of data with xmp data in it.
* @len: the size of @buffer.
* @uri: the URI this is related to.
@@ -453,10 +447,10 @@ iterate (XmpPtr xmp,
* Since: 0.8
**/
gboolean
-tracker_extract_xmp_read (const gchar *buffer,
- size_t len,
- const gchar *uri,
- TrackerXmpData *data)
+tracker_xmp_read (const gchar *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerXmpData *data)
{
#ifdef HAVE_EXEMPI
XmpPtr xmp;
@@ -527,7 +521,7 @@ insert_keywords (TrackerSparqlBuilder *metadata,
}
/**
- * tracker_extract_xmp_apply:
+ * tracker_xmp_apply:
* @metadata: the metadata object to apply XMP data to.
* @uri: the URI this is related to.
* @data: the data to push into @metadata.
@@ -540,9 +534,9 @@ insert_keywords (TrackerSparqlBuilder *metadata,
* Since: 0.8
**/
gboolean
-tracker_extract_xmp_apply (TrackerSparqlBuilder *metadata,
- const gchar *uri,
- TrackerXmpData *data)
+tracker_xmp_apply (TrackerSparqlBuilder *metadata,
+ const gchar *uri,
+ TrackerXmpData *data)
{
g_return_val_if_fail (TRACKER_IS_SPARQL_BUILDER (metadata), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
diff --git a/src/libtracker-extract/tracker-xmp.h b/src/libtracker-extract/tracker-xmp.h
index 175421d..d15f2af 100644
--- a/src/libtracker-extract/tracker-xmp.h
+++ b/src/libtracker-extract/tracker-xmp.h
@@ -25,8 +25,6 @@
#error "only <libtracker-extract/tracker-extract.h> must be included directly."
#endif
-#include <glib.h>
-
#include <libtracker-client/tracker-sparql-builder.h>
G_BEGIN_DECLS
@@ -86,13 +84,13 @@ typedef struct {
gchar *city;
} TrackerXmpData;
-gboolean tracker_extract_xmp_read (const gchar *buffer,
- size_t len,
- const gchar *uri,
- TrackerXmpData *data);
-gboolean tracker_extract_xmp_apply (TrackerSparqlBuilder *metadata,
- const gchar *uri,
- TrackerXmpData *data);
+gboolean tracker_xmp_read (const gchar *buffer,
+ size_t len,
+ const gchar *uri,
+ TrackerXmpData *data);
+gboolean tracker_xmp_apply (TrackerSparqlBuilder *metadata,
+ const gchar *uri,
+ TrackerXmpData *data);
G_END_DECLS
diff --git a/src/tracker-extract/tracker-extract-flac.c b/src/tracker-extract/tracker-extract-flac.c
index 7a1dea5..ae73949 100644
--- a/src/tracker-extract/tracker-extract-flac.c
+++ b/src/tracker-extract/tracker-extract-flac.c
@@ -121,7 +121,7 @@ parse_vorbis_comments (FLAC__StreamMetadata_VorbisComment *comment,
} else if (g_ascii_strncasecmp (entry.entry, "albumpeakgain", 13) == 0) {
fd->albumpeakgain = g_strdup (entry.entry + 14);
} else if (g_ascii_strncasecmp (entry.entry, "date", 4) == 0) {
- fd->date = tracker_extract_guess_date (entry.entry + 5);
+ fd->date = tracker_date_guess (entry.entry + 5);
} else if (g_ascii_strncasecmp (entry.entry, "comment", 7) == 0) {
fd->comment = g_strdup (entry.entry + 8);
} else if (g_ascii_strncasecmp (entry.entry, "genre", 5) == 0) {
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index e230c6b..ff2d1d9 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -227,19 +227,19 @@ extract_jpeg (const gchar *uri,
#ifdef HAVE_LIBEXIF
if (strncmp (EXIF_NAMESPACE, str, EXIF_NAMESPACE_LENGTH) == 0) {
- tracker_extract_exif_read ((unsigned char*) marker->data,
- len,
- uri,
- &ed);
+ tracker_exif_read ((unsigned char*) marker->data,
+ len,
+ uri,
+ &ed);
}
#endif /* HAVE_LIBEXIF */
#ifdef HAVE_EXEMPI
if (strncmp (XMP_NAMESPACE, str, XMP_NAMESPACE_LENGTH) == 0) {
- tracker_extract_xmp_read (str + XMP_NAMESPACE_LENGTH,
- len - XMP_NAMESPACE_LENGTH,
- uri,
- &xd);
+ tracker_xmp_read (str + XMP_NAMESPACE_LENGTH,
+ len - XMP_NAMESPACE_LENGTH,
+ uri,
+ &xd);
}
#endif /* HAVE_EXEMPI */
@@ -252,10 +252,10 @@ extract_jpeg (const gchar *uri,
if (strncmp (PS3_NAMESPACE, str, PS3_NAMESPACE_LENGTH) == 0) {
offset = iptc_jpeg_ps3_find_iptc (str, len, &sublen);
if (offset > 0) {
- tracker_extract_iptc_read (str + offset,
- sublen,
- uri,
- &id);
+ tracker_iptc_read (str + offset,
+ sublen,
+ uri,
+ &id);
}
}
#endif /* HAVE_LIBIPTCDATA */
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 4a5e605..ef351a3 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -744,7 +744,7 @@ get_id3 (const gchar *data,
pos += 30;
year = g_convert (pos, 4, "UTF-8", encoding, NULL, NULL, NULL);
if (atoi (year) > 0) {
- id3->recording_time = tracker_extract_guess_date (year);
+ id3->recording_time = tracker_date_guess (year);
}
g_free (year);
@@ -1237,11 +1237,11 @@ get_id3v24_tags (const gchar *data,
tag->copyright = word;
break;
case ID3V24_TDRC:
- tag->recording_time = tracker_extract_guess_date (word);
+ tag->recording_time = tracker_date_guess (word);
g_free (word);
break;
case ID3V24_TDRL:
- tag->release_time = tracker_extract_guess_date (word);
+ tag->release_time = tracker_date_guess (word);
g_free (word);
break;
case ID3V24_TEXT:
@@ -1292,7 +1292,7 @@ get_id3v24_tags (const gchar *data,
}
case ID3V24_TYER:
if (atoi (word) > 0) {
- tag->recording_time = tracker_extract_guess_date (word);
+ tag->recording_time = tracker_date_guess (word);
}
g_free (word);
break;
@@ -1494,7 +1494,7 @@ get_id3v23_tags (const gchar *data,
}
case ID3V24_TYER:
if (atoi (word) > 0) {
- tag->recording_time = tracker_extract_guess_date (word);
+ tag->recording_time = tracker_date_guess (word);
}
g_free (word);
break;
@@ -1629,7 +1629,7 @@ get_id3v20_tags (const gchar *data,
break;
case ID3V2_TYE:
if (atoi (word) > 0) {
- tag->recording_time = tracker_extract_guess_date (word);
+ tag->recording_time = tracker_date_guess (word);
}
g_free (word);
break;
diff --git a/src/tracker-extract/tracker-extract-msoffice.c b/src/tracker-extract/tracker-extract-msoffice.c
index 59540b6..39bdad1 100644
--- a/src/tracker-extract/tracker-extract-msoffice.c
+++ b/src/tracker-extract/tracker-extract-msoffice.c
@@ -208,7 +208,7 @@ metadata_add_gvalue (TrackerSparqlBuilder *metadata,
if (is_date) {
if (len > 2) {
gchar *str = g_strndup (s + 1, len - 2);
- str_val = tracker_extract_guess_date (str);
+ str_val = tracker_date_guess (str);
g_free (str);
} else {
str_val = NULL;
@@ -223,7 +223,7 @@ metadata_add_gvalue (TrackerSparqlBuilder *metadata,
* beginning.
*/
if (is_date) {
- str_val = tracker_extract_guess_date (s);
+ str_val = tracker_date_guess (s);
} else {
str_val = g_strdup (s);
}
@@ -231,7 +231,7 @@ metadata_add_gvalue (TrackerSparqlBuilder *metadata,
} else {
/* Here, we probably have a number */
if (is_date) {
- str_val = tracker_extract_guess_date (s);
+ str_val = tracker_date_guess (s);
} else {
str_val = g_strdup (s);
}
@@ -552,9 +552,9 @@ ppt_append_text (gchar *text,
g_return_val_if_fail (text, -1);
g_return_val_if_fail (all_texts, -1);
- normalized_text = tracker_extract_text_normalize (text,
- max_words - words,
- &count);
+ normalized_text = tracker_text_normalize (text,
+ max_words - words,
+ &count);
if (normalized_text) {
/* If the last added text didn't end in a space, we'll
@@ -883,7 +883,7 @@ extract_msword_content (GsfInfile *infile,
g_free (clx);
if (content) {
- normalized = tracker_extract_text_normalize (content->str, n_words, NULL);
+ normalized = tracker_text_normalize (content->str, n_words, NULL);
g_string_free (content, TRUE);
}
@@ -1282,7 +1282,7 @@ text_handler_document_data (GMarkupParseContext *context,
case TAG_TYPE_CREATED:
tracker_sparql_builder_predicate (info->metadata, "nie:contentCreated");
- tracker_sparql_builder_object_unvalidated (info->metadata, tracker_extract_guess_date (text));
+ tracker_sparql_builder_object_unvalidated (info->metadata, tracker_date_guess (text));
break;
case TAG_TYPE_GENERATOR:
@@ -1302,7 +1302,7 @@ text_handler_document_data (GMarkupParseContext *context,
case TAG_TYPE_MODIFIED:
tracker_sparql_builder_predicate (info->metadata, "nie:contentLastModified");
- tracker_sparql_builder_object_unvalidated (info->metadata, tracker_extract_guess_date (text));
+ tracker_sparql_builder_object_unvalidated (info->metadata, tracker_date_guess (text));
break;
case TAG_TYPE_NUM_OF_PAGES:
diff --git a/src/tracker-extract/tracker-extract-oasis.c b/src/tracker-extract/tracker-extract-oasis.c
index 31cb23d..59a76e0 100644
--- a/src/tracker-extract/tracker-extract-oasis.c
+++ b/src/tracker-extract/tracker-extract-oasis.c
@@ -87,7 +87,7 @@ extract_content (const gchar *path,
return NULL;
}
- text = tracker_extract_text_normalize (output, n_words, NULL);
+ text = tracker_text_normalize (output, n_words, NULL);
g_free (command);
g_free (output);
@@ -274,7 +274,7 @@ text_handler (GMarkupParseContext *context,
tracker_sparql_builder_object_unvalidated (metadata, text);
break;
case READ_CREATED:
- date = tracker_extract_guess_date (text);
+ date = tracker_date_guess (text);
tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
tracker_sparql_builder_object_unvalidated (metadata, date);
g_free (date);
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 371133a..c12280a 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -241,7 +241,7 @@ extract_content (PopplerDocument *document,
poppler_page_get_size (page, &rect.x2, &rect.y2);
text = poppler_page_get_text (page, POPPLER_SELECTION_WORD, &rect);
- t = tracker_extract_text_normalize (text, n_words - words, &normalized_words);
+ t = tracker_text_normalize (text, n_words - words, &normalized_words);
words += normalized_words;
g_string_append (string, t);
@@ -350,7 +350,7 @@ extract_pdf (const gchar *uri,
}
if (xml) {
- tracker_extract_xmp_read (xml, strlen (xml), uri, &xd);
+ tracker_xmp_read (xml, strlen (xml), uri, &xd);
g_free (xml);
xml = NULL;
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index 4e7617e..b9921d4 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -83,7 +83,7 @@ rfc1123_to_iso8601_date (gchar *date)
/* From: ex. RFC1123 date: "22 May 1997 18:07:10 -0600"
* To : ex. ISO8601 date: "2007-05-22T18:07:10-0600"
*/
- return tracker_extract_date_format_to_iso8601 (date, RFC1123_DATE_FORMAT);
+ return tracker_date_format_to_iso8601 (date, RFC1123_DATE_FORMAT);
}
static void
diff --git a/src/tracker-extract/tracker-extract-ps.c b/src/tracker-extract/tracker-extract-ps.c
index d03e438..856820a 100644
--- a/src/tracker-extract/tracker-extract-ps.c
+++ b/src/tracker-extract/tracker-extract-ps.c
@@ -141,7 +141,7 @@ hour_day_str_day (const gchar *date)
/* From: ex. date: "(18:07 Tuesday 22 May 2007)"
* To : ex. ISO8601 date: "2007-05-22T18:07:10-0600"
*/
- return tracker_extract_date_format_to_iso8601 (date, "(%H:%M %A %d %B %Y)");
+ return tracker_date_format_to_iso8601 (date, "(%H:%M %A %d %B %Y)");
}
static gchar *
@@ -150,7 +150,7 @@ day_str_month_day (const gchar *date)
/* From: ex. date: "Tue May 22 18:07:10 2007"
* To : ex. ISO8601 date: "2007-05-22T18:07:10-0600"
*/
- return tracker_extract_date_format_to_iso8601 (date, "%A %B %d %H:%M:%S %Y");
+ return tracker_date_format_to_iso8601 (date, "%A %B %d %H:%M:%S %Y");
}
static gchar *
@@ -159,7 +159,7 @@ day_month_year_date (const gchar *date)
/* From: ex. date: "22 May 1997 18:07:10 -0600"
* To : ex. ISO8601 date: "2007-05-22T18:07:10-0600"
*/
- return tracker_extract_date_format_to_iso8601 (date, "%d %B %Y %H:%M:%S %z");
+ return tracker_date_format_to_iso8601 (date, "%d %B %Y %H:%M:%S %z");
}
static gchar *
@@ -168,7 +168,7 @@ hour_month_day_date (const gchar *date)
/* From: ex. date: "6:07 PM May 22, 2007"
* To : ex. ISO8601 date: "2007-05-22T18:07:10-0600"
*/
- return tracker_extract_date_format_to_iso8601 (date, "%I:%M %p %B %d, %Y");
+ return tracker_date_format_to_iso8601 (date, "%I:%M %p %B %d, %Y");
}
static gchar *
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 045f361..c4de330 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -282,10 +282,10 @@ extract_tiff (const gchar *uri,
if (TIFFGetField (image, TIFFTAG_RICHTIFFIPTC, &iptcSize, &iptcOffset)) {
if (TIFFIsByteSwapped(image) != 0)
TIFFSwabArrayOfLong((uint32 *) iptcOffset, (unsigned long) iptcSize);
- tracker_extract_iptc_read (iptcOffset,
- 4 * iptcSize,
- uri,
- &iptc_data);
+ tracker_iptc_read (iptcOffset,
+ 4 * iptcSize,
+ uri,
+ &iptc_data);
}
#endif /* HAVE_LIBIPTCDATA */
@@ -293,10 +293,10 @@ extract_tiff (const gchar *uri,
due to bugs in the original spec (type) */
#ifdef HAVE_EXEMPI
if (TIFFGetField (image, TIFFTAG_XMLPACKET, &size, &xmpOffset)) {
- tracker_extract_xmp_read (xmpOffset,
- size,
- uri,
- &xmp_data);
+ tracker_xmp_read (xmpOffset,
+ size,
+ uri,
+ &xmp_data);
}
#endif /* HAVE_EXEMPI */
@@ -310,7 +310,7 @@ extract_tiff (const gchar *uri,
tiff_data.copyright = get_value (image, TIFFTAG_COPYRIGHT, TIFF_TAGTYPE_STRING);
if (!tiff_data.datetime) {
gchar *date = get_value (image, TIFFTAG_DATETIME, TIFF_TAGTYPE_STRING);
- tiff_data.datetime = tracker_extract_guess_date (date);
+ tiff_data.datetime = tracker_date_guess (date);
g_free (date);
}
if (!tiff_data.documentname)
@@ -334,7 +334,7 @@ extract_tiff (const gchar *uri,
exif_data.iso_speed_ratings = get_value (image, EXIFTAG_ISOSPEEDRATINGS, TIFF_TAGTYPE_C16_UINT16);
if (!exif_data.time_original) {
gchar *date = get_value (image, EXIFTAG_DATETIMEORIGINAL, TIFF_TAGTYPE_STRING);
- exif_data.time_original = tracker_extract_guess_date (date);
+ exif_data.time_original = tracker_date_guess (date);
g_free (date);
}
if (!exif_data.metering_mode)
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index 8369179..10a1892 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -89,7 +89,7 @@ extract_vorbis (const char *uri,
gchar *filename;
VorbisData vorbis_data = { 0 };
VorbisNeedsMergeData merge_data = { 0 };
- gchar *artist_uri = NULL, *album_uri = NULL, *publisher_uri = NULL;
+ gchar *artist_uri = NULL, *album_uri = NULL;
filename = g_filename_from_uri (uri, NULL, NULL);
f = tracker_file_open (filename, "r", FALSE);
@@ -119,7 +119,7 @@ extract_vorbis (const char *uri,
vorbis_data.AlbumGain = ogg_get_comment (comment, "AlbumGain");
vorbis_data.AlbumPeakGain = ogg_get_comment (comment, "AlbumPeakGain");
date = ogg_get_comment (comment, "date");
- vorbis_data.date = tracker_extract_guess_date (date);
+ vorbis_data.date = tracker_date_guess (date);
g_free (date);
vorbis_data.comment = ogg_get_comment (comment, "comment");
vorbis_data.genre = ogg_get_comment (comment, "genre");
diff --git a/src/tracker-extract/tracker-extract-xmp.c b/src/tracker-extract/tracker-extract-xmp.c
index a524a1c..66a6f34 100644
--- a/src/tracker-extract/tracker-extract-xmp.c
+++ b/src/tracker-extract/tracker-extract-xmp.c
@@ -145,12 +145,12 @@ extract_xmp (const gchar *uri,
/* If no orig file is found for the sidekick, we use the sidekick to
* describe itself instead, falling back to uri */
- tracker_extract_xmp_read (contents,
- length,
- orig_uri ? orig_uri : uri,
- &xmp_data);
+ tracker_xmp_read (contents,
+ length,
+ orig_uri ? orig_uri : uri,
+ &xmp_data);
- tracker_extract_xmp_apply (metadata, uri, &xmp_data);
+ tracker_xmp_apply (metadata, uri, &xmp_data);
g_free (orig_uri);
}
diff --git a/tests/libtracker-extract/tracker-utils-test.c b/tests/libtracker-extract/tracker-utils-test.c
index 0424854..d789c13 100644
--- a/tests/libtracker-extract/tracker-utils-test.c
+++ b/tests/libtracker-extract/tracker-utils-test.c
@@ -34,31 +34,31 @@ test_guess_date (void)
{
gchar *result;
- result = tracker_extract_guess_date ("");
+ result = tracker_date_guess ("");
g_assert (result == NULL);
- result = tracker_extract_guess_date ("2008-06-14");
+ result = tracker_date_guess ("2008-06-14");
g_assert (tracker_test_helpers_cmpstr_equal (result, "2008-06-14T00:00:00"));
g_free (result);
- result = tracker_extract_guess_date ("20080614000000");
+ result = tracker_date_guess ("20080614000000");
g_assert (tracker_test_helpers_cmpstr_equal (result, "2008-06-14T00:00:00"));
g_free (result);
- result = tracker_extract_guess_date ("20080614000000Z");
+ result = tracker_date_guess ("20080614000000Z");
g_assert (tracker_test_helpers_cmpstr_equal (result, "2008-06-14T00:00:00Z"));
g_free (result);
- result = tracker_extract_guess_date ("Mon Jun 14 04:20:20 2008"); /* MS Office */
+ result = tracker_date_guess ("Mon Jun 14 04:20:20 2008"); /* MS Office */
g_assert (tracker_test_helpers_cmpstr_equal (result, "2008-06-14T04:20:20"));
g_free (result);
- result = tracker_extract_guess_date ("2008:06:14 04:20:20"); /* Exif style */
+ result = tracker_date_guess ("2008:06:14 04:20:20"); /* Exif style */
g_assert (tracker_test_helpers_cmpstr_equal (result, "2008-06-14T04:20:20"));
g_free (result);
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
- result = tracker_extract_guess_date (NULL);
+ result = tracker_date_guess (NULL);
}
g_test_trap_assert_failed ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]