[rygel/rygel-0-18] media-export: Use proper iso8601 date format



commit 4a777bc66cf0b622a5a2eda70c9a577f3b9defdc
Author: Jens Georg <jensg openismus com>
Date:   Wed Jun 19 11:12:20 2013 +0200

    media-export: Use proper iso8601 date format
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702231

 configure.ac                                       |    1 +
 .../rygel-media-export-item-factory.vala           |   21 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5b1846d..29871de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,7 @@ AS_IF([test "x$with_media_engine" = "xgstreamer"],
                                gstreamer-app-1.0 >= $GSTREAMER_APP_REQUIRED
                                gstreamer-tag-1.0 >= $GSTREAMER_TAG_REQUIRED
                                gstreamer-pbutils-1.0 >= $GSTPBU_REQUIRED
+                               libsoup-2.4 >= $LIBSOUP_REQUIRED
                                sqlite3 >= $LIBSQLITE3_REQUIRED
                                uuid])
             RYGEL_PLUGIN_MEDIA_EXPORT_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gupnp-dlna-2.0 
--pkg gupnp-dlna-gst-2.0 --pkg gstreamer-tag-1.0 --pkg gstreamer-app-1.0 --pkg gstreamer-pbutils-1.0 --pkg 
sqlite3"
diff --git a/src/plugins/media-export/rygel-media-export-item-factory.vala 
b/src/plugins/media-export/rygel-media-export-item-factory.vala
index 21f11a9..84c0717 100644
--- a/src/plugins/media-export/rygel-media-export-item-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-item-factory.vala
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
  * Copyright (C) 2008 Nokia Corporation.
- * Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2012,2013 Intel Corporation.
  *
  * Author: Zeeshan Ali <zeenix gmail com>
  *         Jens Georg <jensg openismus com>
@@ -313,7 +313,17 @@ namespace Rygel.MediaExport.ItemFactory {
         // This assumes the datetime is valid; checking some demuxers this
         Gst.DateTime? dt = null;
         if (tags != null && tags.get_date_time (Tags.DATE_TIME, out dt)) {
-            item.date = dt.to_iso8601_string ();
+            // Make a minimal valid iso8601 date - bgo#702231
+            // This mostly happens with MP3 files which only have a year
+            if (!dt.has_day () || !dt.has_month ()) {
+                item.date = "%d-%02d-%02d".printf (dt.get_year (),
+                                                   dt.has_month () ?
+                                                       dt.get_month () : 1,
+                                                   dt.has_day () ?
+                                                       dt.get_day () : 1);
+            } else {
+                item.date = dt.to_iso8601_string ();
+            }
         }
 
         item.title = title;
@@ -327,6 +337,13 @@ namespace Rygel.MediaExport.ItemFactory {
             item.date = tv.to_iso8601 ();
         }
 
+        // If the date has a timezone offset, make sure it contains a
+        // colon bgo#702231, DLNA 7.3.21.1
+        if ("T" in item.date) {
+            var date = new Soup.Date.from_string (item.date);
+            item.date = date.to_string (Soup.DateFormat.ISO8601_FULL);
+        }
+
         item.size = (int64) file_info.get_size ();
         item.modified = (int64) mtime;
         if (profile != null && profile.name != null) {


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