Index: src/tracker-extract/Makefile.am =================================================================== RCS file: /cvs/gnome/tracker/src/tracker-extract/Makefile.am,v retrieving revision 1.10 diff -u -p -r1.10 Makefile.am --- src/tracker-extract/Makefile.am 16 Oct 2006 23:57:44 -0000 1.10 +++ src/tracker-extract/Makefile.am 17 Oct 2006 14:48:38 -0000 @@ -19,7 +19,8 @@ tracker_extract_SOURCES = tracker-extrac tracker-extract-exif.c \ tracker-extract-msoffice.c \ tracker-extract-imagemagick.c \ - tracker-extract-mplayer.c + tracker-extract-mplayer.c \ + tracker-extract-totem.c tracker_extract_LDADD = $(GLIB2_LIBS) \ Index: src/tracker-extract/tracker-extract.c =================================================================== RCS file: /cvs/gnome/tracker/src/tracker-extract/tracker-extract.c,v retrieving revision 1.15 diff -u -p -r1.15 tracker-extract.c --- src/tracker-extract/tracker-extract.c 16 Oct 2006 23:57:44 -0000 1.15 +++ src/tracker-extract/tracker-extract.c 17 Oct 2006 14:48:51 -0000 @@ -71,6 +71,7 @@ void tracker_extract_exif (gchar *, GH #endif void tracker_extract_imagemagick (gchar *, GHashTable *); void tracker_extract_mplayer (gchar *, GHashTable *); +void tracker_extract_totem (gchar *, GHashTable *); MimeToExtractor extractors[] = { /* Document extractors */ @@ -88,6 +89,7 @@ MimeToExtractor extractors[] = { /* Video extractors */ { "video/*", tracker_extract_mplayer }, + { "video/*", tracker_extract_totem }, /* Audio extractors */ Index: src/tracker-extract/tracker-extract-mplayer.c =================================================================== RCS file: /cvs/gnome/tracker/src/tracker-extract/tracker-extract-mplayer.c,v retrieving revision 1.1 diff -u -p -r1.1 tracker-extract-mplayer.c --- src/tracker-extract/tracker-extract-mplayer.c 16 Oct 2006 23:58:29 -0000 1.1 +++ src/tracker-extract/tracker-extract-mplayer.c 17 Oct 2006 14:49:02 -0000 @@ -5,7 +5,7 @@ #include #include -gchar *video_tags[][2] = { +static gchar *video_tags[][2] = { { "ID_VIDEO_HEIGHT", "Video.Height" }, { "ID_VIDEO_WIDTH", "Video.Width" }, { "ID_VIDEO_FPS", "Video.FrameRate" }, @@ -14,7 +14,7 @@ gchar *video_tags[][2] = { { NULL, NULL } }; -gchar *audio_tags[][2] = { +static gchar *audio_tags[][2] = { { "ID_AUDIO_BITRATE", "Audio.Bitrate" }, { "ID_AUDIO_RATE", "Audio.Samplerate" }, { "ID_AUDIO_CODEC", "Audio.Codec" }, @@ -22,7 +22,7 @@ gchar *audio_tags[][2] = { { NULL, NULL } }; -gchar *info_tags[][2] = { +static gchar *info_tags[][2] = { { "comments", "Video.Comment" }, { "name", "Video.Title" }, { "author", "Video.Author" }, --- /dev/null 2006-10-17 09:26:16.000000000 -0400 +++ src/tracker-extract/tracker-extract-totem.c 2006-10-17 10:47:57.000000000 -0400 @@ -0,0 +1,65 @@ + +#include "config.h" + +#include +#include +#include + +static gchar *tags[][2] = { + { "TOTEM_INFO_VIDEO_HEIGHT", "Video.Height" }, + { "TOTEM_INFO_VIDEO_WIDTH", "Video.Width" }, + { "TOTEM_INFO_FPS", "Video.FrameRate" }, + { "TOTEM_INFO_VIDEO_CODEC", "Video.Codec" }, + { "TOTEM_INFO_VIDEO_BITRATE", "Video.Bitrate" }, + { "TOTEM_INFO_TITLE", "Video.Title" }, + { "TOTEM_INFO_AUTHOR", "Video.Author" }, + // { "TOTEM_INFO_YEAR", ... + // { "TOTEM_INFO_ALBUM", ... + // { "TOTEM_INFO_DURATION", ... + // { "TOTEM_INFO_TRACK_NUMBER", ... + { "TOTEM_INFO_AUDIO_BITRATE", "Audio.Bitrate" }, + { "TOTEM_INFO_AUDIO_SAMPLE_RATE", "Audio.Samplerate" }, + { "TOTEM_INFO_AUDIO_CODEC", "Audio.Codec" }, + { "TOTEM_INFO_AUDIO_CHANNELS", "Audio.Channels" }, + { NULL, NULL } + }; + + +void +tracker_extract_totem (gchar *filename, GHashTable *metadata) +{ + gchar *argv[3]; + gchar *totem; + gchar **lines, **line; + gint i; + + argv[0] = g_strdup ("totem-video-indexer"); + argv[1] = g_strdup (filename); + argv[2] = NULL; + + if(g_spawn_sync (NULL, + argv, + NULL, + G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, + NULL, + NULL, + &totem, + NULL, + NULL, + NULL)) { + + + lines = g_strsplit (totem, "\n", -1); + + for (line = lines; *line; ++line) { + + for (i=0; tags[i][0]; i++) { + if (g_str_has_prefix (*line, tags[i][0])) { + g_hash_table_insert (metadata, + g_strdup (tags[i][1]), + g_strdup ((*line) + strlen (tags[i][0]) + 1)); + } + } + } + } +}