Hey -
What do you think about this patch? If trackerd finds Doc.Keywords
embeded in a file, it'll automatically adds those keywords to
tracker's tag list. If you like, I can update it for File.Keywords
and Imag.Keywords.
Quick dump of tracker.log as an example:
Extracting Metadata for *existing* file
/home/eduffy/Desktop/LaTeX/symbols-letter.pdf with mime
application/pdf
Doc.Author = Scott Pakin <[EMAIL PROTECTED]>
Doc.Keywords = symbols, LaTeX, typesetting, accents, mathematical,
scientific, dingbats
Doc.Title = The Comprehensive LaTeX Symbol List
Doc.PageCount = 111
Doc.Subject = List of thousands of symbols available to LaTeX documents
Auto-tagging /home/eduffy/Desktop/LaTeX/symbols-letter.pdf with "symbols"
Auto-tagging /home/eduffy/Desktop/LaTeX/symbols-letter.pdf with "LaTeX"
Auto-tagging /home/eduffy/Desktop/LaTeX/symbols-letter.pdf with "typesetting"
Auto-tagging /home/eduffy/Desktop/LaTeX/symbols-letter.pdf with "accents"
Auto-tagging /home/eduffy/Desktop/LaTeX/symbols-letter.pdf with "mathematical"
Auto-tagging /home/eduffy/Desktop/LaTeX/symbols-letter.pdf with "scientific"
Auto-tagging /home/eduffy/Desktop/LaTeX/symbols-letter.pdf with "dingbats"
# tracker-tag -l symbols-letter.pdf
/home/eduffy/Desktop/LaTeX/symbols-letter.pdf: LaTeX accents dingbats
mathematical scientific symbols typesetting
Index: src/trackerd/trackerd.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/trackerd.c,v
retrieving revision 1.39
diff -u -p -r1.39 trackerd.c
--- src/trackerd/trackerd.c 27 Sep 2006 10:34:56 -0000 1.39
+++ src/trackerd/trackerd.c 27 Sep 2006 16:46:17 -0000
@@ -1079,9 +1079,35 @@ extract_metadata_thread (void)
tracker_metadata_get_embedded (info->uri, info->mime, meta_table);
if (g_hash_table_size (meta_table) > 0) {
+ gchar **keywords;
+ gchar *keys;
+
tracker_db_save_metadata (db_con, meta_table, info->file_id, info->is_new);
/* to do - emit dbus signal here for EmbeddedMetadataChanged */
+
+ /* Convert Doc.Keywords to tracker keywords */
+ if (keys = g_hash_table_lookup (meta_table, "Doc.Keywords")) {
+ gchar *name, *path, **tag;
+
+ if (info->uri[0] == G_DIR_SEPARATOR) {
+ name = g_path_get_basename (info->uri);
+ path = g_path_get_dirname (info->uri);
+ } else {
+ name = tracker_get_vfs_name (info->uri);
+ path = tracker_get_vfs_path (info->uri);
+ }
+
+ keywords = g_strsplit (keys, ",", 0);
+ for (tag = keywords; *tag; ++tag) {
+ tracker_log ("Auto-tagging %s with \"%s\"", info->uri, g_strstrip (*tag));
+ tracker_exec_proc (db_con, "AddKeyword", 3, path, name, g_strstrip (*tag));
+ }
+ g_strfreev (keywords);
+ g_free (name);
+ g_free (path);
+ }
+
}
g_hash_table_destroy (meta_table);
_______________________________________________
tracker-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/tracker-list