[Tracker] PATCH: Extend oasis extractor to include drawing files
- From: Karl Relton <karllinuxtest relton ntlworld com>
- To: tracker-list gnome org
- Subject: [Tracker] PATCH: Extend oasis extractor to include drawing files
- Date: Tue, 24 Apr 2012 10:17:24 +0100
This patch upgrades the oasis extractor to extract text out of
graphic/drawing files (typical LibreOffice file extension .odg).
Karl
--- tracker-0.14.0.orig/src/tracker-extract/tracker-extract-oasis.c 2012-04-24 10:14:53.565748834 +0100
+++ tracker-0.14.0/src/tracker-extract/tracker-extract-oasis.c 2012-04-13 19:24:32.271191132 +0100
@@ -40,14 +40,16 @@ typedef enum {
ODT_TAG_TYPE_GENERATOR,
ODT_TAG_TYPE_WORD_TEXT,
ODT_TAG_TYPE_SLIDE_TEXT,
- ODT_TAG_TYPE_SPREADSHEET_TEXT
+ ODT_TAG_TYPE_SPREADSHEET_TEXT,
+ ODT_TAG_TYPE_GRAPHICS_TEXT
} ODTTagType;
typedef enum {
FILE_TYPE_INVALID,
FILE_TYPE_ODP,
FILE_TYPE_ODT,
- FILE_TYPE_ODS
+ FILE_TYPE_ODS,
+ FILE_TYPE_ODG
} ODTFileType;
typedef struct {
@@ -213,6 +215,8 @@ tracker_extract_get_metadata (TrackerExt
file_type = FILE_TYPE_ODP;
} else if (g_ascii_strcasecmp (mime_used, "application/vnd.oasis.opendocument.spreadsheet") == 0) {
file_type = FILE_TYPE_ODS;
+ } else if (g_ascii_strcasecmp (mime_used, "application/vnd.oasis.opendocument.graphics") == 0) {
+ file_type = FILE_TYPE_ODG;
} else {
g_message ("Mime type was not recognised:'%s'", mime_used);
file_type = FILE_TYPE_INVALID;
@@ -412,6 +416,14 @@ xml_start_element_handler_content (GMark
}
break;
+ case FILE_TYPE_ODG:
+ if (g_ascii_strncasecmp (element_name, "text", 4) == 0) {
+ data->current = ODT_TAG_TYPE_GRAPHICS_TEXT;
+ } else {
+ data->current = -1;
+ }
+ break;
+
case FILE_TYPE_INVALID:
g_message ("Open Office Document type: %d invalid", data->file_type);
break;
@@ -444,6 +456,7 @@ xml_text_handler_content (GMarkupParseCo
case ODT_TAG_TYPE_WORD_TEXT:
case ODT_TAG_TYPE_SLIDE_TEXT:
case ODT_TAG_TYPE_SPREADSHEET_TEXT:
+ case ODT_TAG_TYPE_GRAPHICS_TEXT:
if (data->bytes_pending == 0) {
g_set_error_literal (error,
maximum_size_error_quark, 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]