[tracker/writeback: 20/23] Improvements for the XMP and MP3 writeback modules
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/writeback: 20/23] Improvements for the XMP and MP3 writeback modules
- Date: Sun, 22 Nov 2009 12:41:12 +0000 (UTC)
commit 1feaf07c09863097eec1c5b125a3cb6d4d575cb7
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Nov 19 12:18:22 2009 +0100
Improvements for the XMP and MP3 writeback modules
src/tracker-writeback/tracker-writeback-mp3.c | 7 ++-
src/tracker-writeback/tracker-writeback-xmp.c | 58 +++++++++++++++---------
2 files changed, 40 insertions(+), 25 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-mp3.c b/src/tracker-writeback/tracker-writeback-mp3.c
index ec2a34b..ee2c69c 100644
--- a/src/tracker-writeback/tracker-writeback-mp3.c
+++ b/src/tracker-writeback/tracker-writeback-mp3.c
@@ -84,8 +84,9 @@ tracker_writeback_mp3_update_file_metadata (TrackerWritebackFile *writeback_file
mime_type = g_file_info_get_content_type (file_info);
- if (g_strcmp0 (mime_type, "audio/mpeg") != 0 &&
- g_strcmp0 (mime_type, "audio/x-mp3") != 0) {
+ if (g_strcmp0 (mime_type, "audio/mpeg") != 0 && /* .mp3 files */
+ g_strcmp0 (mime_type, "audio/x-mp3") != 0) { /* .mp3 files */
+
g_object_unref (file_info);
return FALSE;
}
@@ -140,7 +141,7 @@ writeback_module_create (GTypeModule *module)
const gchar**
writeback_module_get_rdftypes (void)
{
- static const gchar *rdftypes[] = { TRACKER_NMM_PREFIX "MusicPiece",
+ static const gchar *rdftypes[] = { TRACKER_NFO_PREFIX "Audio",
NULL };
return rdftypes;
diff --git a/src/tracker-writeback/tracker-writeback-xmp.c b/src/tracker-writeback/tracker-writeback-xmp.c
index db4b527..ca2726b 100644
--- a/src/tracker-writeback/tracker-writeback-xmp.c
+++ b/src/tracker-writeback/tracker-writeback-xmp.c
@@ -91,7 +91,9 @@ tracker_writeback_xmp_update_file_metadata (TrackerWritebackFile *writeback_file
guint n;
XmpFilePtr xmp_files;
XmpPtr xmp;
- /* gboolean debug = TRUE; */
+#ifdef DEBUG_XMP
+ XmpStringPtr str;
+#endif
file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -103,12 +105,22 @@ tracker_writeback_xmp_update_file_metadata (TrackerWritebackFile *writeback_file
mime_type = g_file_info_get_content_type (file_info);
- if (g_strcmp0 (mime_type, "application/rdf+xml") != 0 && /* .xmp files */
- g_strcmp0 (mime_type, "application/pdf") != 0 && /* .pdf files */
- g_strcmp0 (mime_type, "image/png") != 0 && /* .png files */
- g_strcmp0 (mime_type, "sketch/png") != 0 && /* .sketch.png files on Maemo*/
- g_strcmp0 (mime_type, "image/jpeg") != 0 && /* .jpg & .jpeg files */
- g_strcmp0 (mime_type, "image/tiff") != 0 /* .tiff & .tif files */) {
+ /* Tested filetypes */
+ if (g_strcmp0 (mime_type, "application/rdf+xml") != 0 && /* .xmp files */
+ g_strcmp0 (mime_type, "application/pdf") != 0 && /* .pdf files */
+ g_strcmp0 (mime_type, "image/png") != 0 && /* .png files */
+ g_strcmp0 (mime_type, "sketch/png") != 0 && /* .sketch.png files on Maemo*/
+ g_strcmp0 (mime_type, "image/jpeg") != 0 && /* .jpg & .jpeg files */
+ g_strcmp0 (mime_type, "image/gif") != 0 && /* .jpg & .jpeg files */
+ g_strcmp0 (mime_type, "image/tiff") != 0 && /* .tiff & .tif files */
+
+ /* Less certain filetypes */
+ g_strcmp0 (mime_type, "application/postscript") != 0 && /* .ps files */
+ g_strcmp0 (mime_type, "application/x-shockwave-flash") != 0 && /* .swf files */
+ g_strcmp0 (mime_type, "video/quicktime") != 0 && /* .mov files */
+ g_strcmp0 (mime_type, "video/mpeg") != 0 && /* .mpeg & .mpg files */
+ g_strcmp0 (mime_type, "audio/mpeg") != 0 ) { /* .mp3, etc files */
+
g_object_unref (file_info);
return FALSE;
}
@@ -130,14 +142,13 @@ tracker_writeback_xmp_update_file_metadata (TrackerWritebackFile *writeback_file
return FALSE;
}
- /* if (debug) {
- XmpStringPtr str = xmp_string_new();
- g_print ("\nBEFORE: ---- \n");
- xmp_serialize_and_format(xmp, str, 0, 0, "\n", "\t", 1);
- printf ("%s\n", xmp_string_cstr (str));
- xmp_string_free (str);
- g_print ("\nAFTER: ---- \n");
- } */
+#ifdef DEBUG_XMP
+ str = xmp_string_new();
+ g_print ("\nBEFORE: ---- \n");
+ xmp_serialize_and_format(xmp, str, 0, 0, "\n", "\t", 1);
+ printf ("%s\n", xmp_string_cstr (str));
+ xmp_string_free (str);
+#endif
for (n = 0; n < values->len; n++) {
const GStrv row = g_ptr_array_index (values, n);
@@ -155,13 +166,14 @@ tracker_writeback_xmp_update_file_metadata (TrackerWritebackFile *writeback_file
/* TODO: Add more */
}
- /* if (debug) {
- XmpStringPtr str = xmp_string_new();
- xmp_serialize_and_format(xmp, str, 0, 0, "\n", "\t", 1);
- printf ("%s\n", xmp_string_cstr (str));
- xmp_string_free (str);
- g_print ("\n : ---- \n");
- } */
+#ifdef DEBUG_XMP
+ g_print ("\nAFTER: ---- \n");
+ str = xmp_string_new();
+ xmp_serialize_and_format(xmp, str, 0, 0, "\n", "\t", 1);
+ printf ("%s\n", xmp_string_cstr (str));
+ xmp_string_free (str);
+ g_print ("\n --------- \n");
+#endif
if (xmp_files_can_put_xmp(xmp_files, xmp)) {
xmp_files_put_xmp(xmp_files, xmp);
@@ -188,6 +200,8 @@ const gchar**
writeback_module_get_rdftypes (void)
{
static const gchar *rdftypes[] = { TRACKER_NFO_PREFIX "Image",
+ TRACKER_NFO_PREFIX "Audio",
+ TRACKER_NFO_PREFIX "Video",
NULL };
return rdftypes;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]