[tracker-miners/sam/libav-testing: 10/14] tracker-extract-gstreamer: Use 'Z' in datetimes instead of +00:00




commit 1296247438afff29eec58d2f6415dacb5fbb4bb4
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Wed Aug 31 12:26:13 2022 +0200

    tracker-extract-gstreamer: Use 'Z' in datetimes instead of +00:00
    
    Both representations are equivalent, but prefer the short one for
    consistency with the ffmpeg/libav extractor.
    
    Note that the test suite doesn't query type info, it compares dates
    as strings so if the date format is not the same for both we get test
    failures.

 src/tracker-extract/tracker-extract-gstreamer.c    | 28 +++++++++++++++-------
 .../audio/flac-musicbrainz.expected.json           |  2 +-
 .../test-extraction-data/audio/flac.expected.json  |  2 +-
 3 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index f64413f72..6575cd7da 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -204,15 +204,25 @@ get_gst_date_time_to_buf (GstDateTime *date_time,
                complete = FALSE;
        }
 
-       snprintf (buf, size, "%04d-%02d-%02dT%02d:%02d:%02d%s%02d:00",
-                 year,
-                 month,
-                 day,
-                 hour,
-                 minute,
-                 second,
-                 offset_str,
-                 (gint) ABS (offset));
+       if (offset == 0.0) {
+               snprintf (buf, size, "%04d-%02d-%02dT%02d:%02d:%02dZ",
+                         year,
+                         month,
+                         day,
+                         hour,
+                         minute,
+                         second);
+       } else {
+               snprintf (buf, size, "%04d-%02d-%02dT%02d:%02d:%02d%s%02d:00",
+                         year,
+                         month,
+                         day,
+                         hour,
+                         minute,
+                         second,
+                         offset_str,
+                         (gint) ABS (offset));
+       }
 
        return complete;
 }
diff --git a/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json 
b/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
index 2dc8fd1d7..aec2b91a5 100644
--- a/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/flac-musicbrainz.expected.json
@@ -12,7 +12,7 @@
         "nfo:genre": "Rock",
         "nfo:sampleRate": "44100",
         "nie:comment": "no comment",
-        "nie:contentCreated": "2020-01-01T00:00:00+00:00",
+        "nie:contentCreated": "2020-01-01T00:00:00Z",
         "nie:copyright": "none",
         "nie:title": "track title",
         "nmm:trackNumber": "12",
diff --git a/tests/functional-tests/test-extraction-data/audio/flac.expected.json 
b/tests/functional-tests/test-extraction-data/audio/flac.expected.json
index dfdd9f4ab..4becc7bb8 100644
--- a/tests/functional-tests/test-extraction-data/audio/flac.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/flac.expected.json
@@ -12,7 +12,7 @@
         "nfo:genre": "Rock",
         "nfo:sampleRate": "44100",
         "nie:comment": "no comment",
-        "nie:contentCreated": "2020-01-01T00:00:00+00:00",
+        "nie:contentCreated": "2020-01-01T00:00:00Z",
         "nie:copyright": "none",
         "nie:title": "track title",
         "nmm:trackNumber": "12",


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