[tracker] Add an empty BMP extractor to get the rdf:type for the file type right
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] Add an empty BMP extractor to get the rdf:type for the file type right
- Date: Tue, 25 Mar 2014 09:18:23 +0000 (UTC)
commit e072e2845c37e00e71978d06abd534fee84cdb14
Author: Philip Van Hoof <philip codeminded be>
Date: Sun Mar 2 14:02:16 2014 +0100
Add an empty BMP extractor to get the rdf:type for the file type right
src/tracker-extract/10-bmp.rule | 4 ++
src/tracker-extract/Makefile.am | 15 +++++++
src/tracker-extract/tracker-extract-bmp.c | 61 +++++++++++++++++++++++++++++
3 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/10-bmp.rule b/src/tracker-extract/10-bmp.rule
new file mode 100644
index 0000000..c1f050e
--- /dev/null
+++ b/src/tracker-extract/10-bmp.rule
@@ -0,0 +1,4 @@
+[ExtractorRule]
+ModulePath=libextract-bmp.so
+MimeTypes=image/bmp
+
diff --git a/src/tracker-extract/Makefile.am b/src/tracker-extract/Makefile.am
index 13acf65..82ee455 100644
--- a/src/tracker-extract/Makefile.am
+++ b/src/tracker-extract/Makefile.am
@@ -38,6 +38,7 @@ rules_files = \
10-vorbis.rule \
10-xmp.rule \
10-xps.rule \
+ 10-bmp.rule \
11-iso.rule \
11-msoffice-xml.rule \
15-gstreamer-guess.rule \
@@ -180,6 +181,9 @@ extractmodules_LTLIBRARIES += libextract-libav.la
rules_DATA += 90-libav-audio-generic.rule 90-libav-video-generic.rule
endif
+extractmodules_LTLIBRARIES += libextract-bmp.la
+rules_DATA += 10-bmp.rule
+
# ABW
libextract_abw_la_SOURCES = tracker-extract-abw.c
libextract_abw_la_CFLAGS = $(TRACKER_EXTRACT_MODULES_CFLAGS)
@@ -492,6 +496,17 @@ libextract_libav_la_LIBADD = \
$(AVCODEC_LIBS)
+# BMP
+libextract_bmp_la_SOURCES = tracker-extract-bmp.c
+libextract_bmp_la_CFLAGS = \
+ $(TRACKER_EXTRACT_MODULES_CFLAGS)
+libextract_bmp_la_LDFLAGS = $(module_flags)
+libextract_bmp_la_LIBADD = \
+ $(top_builddir)/src/libtracker-extract/libtracker-extract- TRACKER_API_VERSION@.la \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(BUILD_LIBS) \
+ $(TRACKER_EXTRACT_MODULES_LIBS)
+
#
# Binaries
#
diff --git a/src/tracker-extract/tracker-extract-bmp.c b/src/tracker-extract/tracker-extract-bmp.c
new file mode 100644
index 0000000..43fe7ef
--- /dev/null
+++ b/src/tracker-extract/tracker-extract-bmp.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013-2014 Jolla Ltd. <andrew den exter jollamobile com>
+ * Author: Philip Van Hoof <philip codeminded be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <libtracker-common/tracker-common.h>
+#include <libtracker-extract/tracker-extract.h>
+
+
+G_MODULE_EXPORT gboolean
+tracker_extract_get_metadata (TrackerExtractInfo *info)
+{
+ TrackerSparqlBuilder *preupdate, *metadata;
+ goffset size;
+ const gchar *graph;
+ gchar *filename, *uri;
+ GFile *file;
+
+ preupdate = tracker_extract_info_get_preupdate_builder (info);
+ metadata = tracker_extract_info_get_metadata_builder (info);
+ graph = tracker_extract_info_get_graph (info);
+
+ file = tracker_extract_info_get_file (info);
+ filename = g_file_get_path (file);
+ size = tracker_file_get_size (filename);
+
+ if (size < 14) {
+ /* Smaller than BMP header, can't be a real BMP file */
+ g_free (filename);
+ return FALSE;
+ }
+
+ tracker_sparql_builder_predicate (metadata, "a");
+ tracker_sparql_builder_object (metadata, "nfo:Image");
+ tracker_sparql_builder_object (metadata, "nmm:Photo");
+
+ /* TODO: Add actual metadata extraction for BMP files */
+
+ return TRUE;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]