[gthumb] Implemented bug 583466 – stupid comment filter



commit 356e8b8c21b3760e2b7db97a3cf9ddc7bf2ef7b4
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Fri Jun 5 09:25:19 2009 -0400

    Implemented bug 583466 â?? stupid comment filter
---
 libgthumb/gth-exif-utils.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/libgthumb/gth-exif-utils.c b/libgthumb/gth-exif-utils.c
index 4312fa3..8ef87e7 100644
--- a/libgthumb/gth-exif-utils.c
+++ b/libgthumb/gth-exif-utils.c
@@ -152,6 +152,14 @@ const char **TAG_NAME_SETS[] = {
 };
 
 
+/* Some evil camera fill in the ImageDescription or UserComment fields
+   with useless fluff. Try to filter these out, so they do not show up
+   as comments */
+const char *stupid_comment_filter[] = {
+	"OLYMPUS DIGITAL CAMERA",
+	NULL };
+
+
 GList * read_exiv2_file (const char *uri, GList *metadata);
 GList * read_exiv2_sidecar (const char *uri, GList *metadata);
 void    write_metadata (const char *from_file, const char *to_file, GList *metadata);
@@ -313,7 +321,18 @@ get_metadata_tagset_string (FileData *fd, const char *tagnames[])
 			string = g_strdup (md_entry->formatted_value);
 		}
 	}
-		
+
+	if ((string != NULL) &&
+	    (!strcmp (tagnames[i-1], "Exif.Photo.UserComment") ||
+	     !strcmp (tagnames[i-1], "Exif.Image.ImageDescription"))) {
+		for (i = 0; (string != NULL) && (stupid_comment_filter[i] != NULL); i++) {
+			if (strstr (string, stupid_comment_filter[i]) != NULL) {
+				g_free (string);
+				string = NULL;
+			}
+		}
+	}
+
 	return string;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]