[rhythmbox] metadata: prefer GST_TAG_DATE to GST_TAG_DATE_TIME



commit 277dba4db14b4a3525562df50a5c31422e877731
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Aug 6 09:14:59 2014 +1000

    metadata: prefer GST_TAG_DATE to GST_TAG_DATE_TIME
    
    mp4 appears to be the only format that uses both, and it places more
    reliable data in GST_TAG_DATE, so taking that in preference to
    GST_TAG_DATE_TIME should work for all formats.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734235

 metadata/rb-metadata-gst.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/metadata/rb-metadata-gst.c b/metadata/rb-metadata-gst.c
index 95be3c9..4ae5d94 100644
--- a/metadata/rb-metadata-gst.c
+++ b/metadata/rb-metadata-gst.c
@@ -860,7 +860,16 @@ rb_metadata_get (RBMetaData *md, RBMetaDataField field, GValue *ret)
                if (tags == NULL)
                        return FALSE;
 
-               if (gst_tag_list_get_date_time (tags, GST_TAG_DATE_TIME, &datetime)) {
+               /* mp4 generally gives us useful things in GST_TAG_DATE and garbage in GST_TAG_DATE_TIME,
+                * and everything else just gives us GST_TAG_DATE_TIME.  preferring GST_TAG_DATE should
+                * make mp4 work better without breaking anything else.
+                */
+               if (gst_tag_list_get_date (tags, GST_TAG_DATE, &dateptr)) {
+                       g_value_init (ret, G_TYPE_ULONG);
+                       g_value_set_ulong (ret, g_date_get_julian (dateptr));
+                       g_date_free (dateptr);
+                       return TRUE;
+               } else if (gst_tag_list_get_date_time (tags, GST_TAG_DATE_TIME, &datetime)) {
                        GDate date;
                        g_date_set_dmy (&date,
                                        gst_date_time_has_day (datetime) ? gst_date_time_get_day (datetime) : 
1,
@@ -872,11 +881,6 @@ rb_metadata_get (RBMetaData *md, RBMetaDataField field, GValue *ret)
 
                        gst_date_time_unref (datetime);
                        return TRUE;
-               } else if (gst_tag_list_get_date (tags, GST_TAG_DATE, &dateptr)) {
-                       g_value_init (ret, G_TYPE_ULONG);
-                       g_value_set_ulong (ret, g_date_get_julian (dateptr));
-                       g_date_free (dateptr);
-                       return TRUE;
                } else {
                        return FALSE;
                }


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