tracker r2173 - in branches/indexer-split: . src/tracker-indexer
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2173 - in branches/indexer-split: . src/tracker-indexer
- Date: Wed, 27 Aug 2008 17:02:03 +0000 (UTC)
Author: carlosg
Date: Wed Aug 27 17:02:02 2008
New Revision: 2173
URL: http://svn.gnome.org/viewvc/tracker?rev=2173&view=rev
Log:
2008-08-27 Carlos Garnacho <carlos imendio com>
* src/tracker-indexer/tracker-metadata-utils.[ch]
(tracker_metadata_utils_get_thumbnail): Added back thumbnails
creation.
(tracker_metadata_utils_get_data): Call it from here.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c
branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h
Modified: branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c Wed Aug 27 17:02:02 2008
@@ -301,6 +301,10 @@
g_filename_to_utf8 (path, -1, NULL, NULL, NULL));
tracker_metadata_insert (metadata, METADATA_FILE_MIMETYPE, mimetype);
+ if (mimetype) {
+ tracker_metadata_utils_get_thumbnail (path, mimetype);
+ }
+
if (S_ISLNK (st.st_mode)) {
gchar *link_path;
@@ -510,6 +514,53 @@
return text;
}
+gchar *
+tracker_metadata_utils_get_thumbnail (const gchar *path,
+ const gchar *mime)
+{
+ ProcessContext *context;
+ GString *thumbnail;
+ gchar *argv[5];
+
+ argv[0] = g_strdup ("tracker-thumbnailer");
+ argv[1] = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
+ argv[2] = g_strdup (mime);
+ argv[3] = g_strdup ("normal");
+ argv[4] = NULL;
+
+ context = create_process_context ((const gchar **) argv);
+
+ if (!context) {
+ return NULL;
+ }
+
+ thumbnail = g_string_new (NULL);
+ context->data = thumbnail;
+
+ g_io_add_watch (context->stdout_channel,
+ G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
+ tracker_text_read,
+ context);
+
+ g_main_loop_run (context->data_incoming_loop);
+
+ g_free (argv[0]);
+ g_free (argv[1]);
+ g_free (argv[2]);
+ g_free (argv[3]);
+
+ destroy_process_context (context);
+
+ if (!thumbnail->str || !*thumbnail->str) {
+ g_string_free (thumbnail, TRUE);
+ return NULL;
+ }
+
+ g_debug ("Got thumbnail '%s' for '%s'", thumbnail->str, path);
+
+ return g_string_free (thumbnail, FALSE);
+}
+
typedef struct {
TrackerMetadata *old_metadata;
TrackerMetadata *new_metadata;
Modified: branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h Wed Aug 27 17:02:02 2008
@@ -46,8 +46,10 @@
void tracker_metadata_utils_action_item_free (MetadataActionItem *item,
gpointer user_data);
-TrackerMetadata * tracker_metadata_utils_get_data (const gchar *path);
-gchar * tracker_metadata_utils_get_text (const gchar *path);
+TrackerMetadata * tracker_metadata_utils_get_data (const gchar *path);
+gchar * tracker_metadata_utils_get_text (const gchar *path);
+gchar * tracker_metadata_utils_get_thumbnail (const gchar *path,
+ const gchar *mime);
GSList * tracker_metadata_utils_calculate_merge (TrackerMetadata *old_metadata,
TrackerMetadata *new_metadata);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]