[tracker/miner-web-review: 68/74] tracker-extract: Added extra check for date validity



commit 9f6836c751f89bd80c0e6277d80cf620fb3563ff
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Feb 26 12:50:49 2010 +0100

    tracker-extract: Added extra check for date validity

 src/tracker-extract/tracker-extract-gstreamer.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index f28ff4b..1ae95c9 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -282,13 +282,24 @@ add_y_date_gst_tag (TrackerSparqlBuilder  *metadata,
                     GstTagList  *tag_list,
                     const gchar *tag)
 {
-	GDate    *date = NULL;
+	GDate    *date;
 	gboolean  ret;
 
 	date = NULL;
 	ret = gst_tag_list_get_date (tag_list, tag, &date);
 
 	if (ret) {
+		if (date && g_date_valid (date)) {
+			if (date->julian) {
+				ret = g_date_valid_julian (date->julian_days);
+			if (date->dmy)
+				ret = g_date_valid_dmy (date->day, date->month, date->year);
+			} else
+				ret = FALSE;
+		}
+	}
+
+	if (ret) {
 		gchar buf[25];
 
 		if (g_date_strftime (buf, 25, "%Y-%m-%dT%H:%M:%S%z", date)) {



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