[tracker-miners/wip/jfelder/gstreamer-extractor-album-date] tracker-extract-gstreamer: Correctly use the date for album uri



commit 92563a2e39d08fcafad7537e9db9e5b2d6619f6b
Author: Jean Felder <jfelder src gnome org>
Date:   Mon May 25 00:33:37 2020 +0200

    tracker-extract-gstreamer: Correctly use the date for album uri
    
    This fixes a regression introduced by commits
    84ae27bef23123b7997251ac4f441229a875715c and
    d592c96731c24fc957dfb89052b295a75c841015
    
    Prior to those commits, the tag_date_time (or tag_time as fallback)
    was used if it contained a minimal string compatible with
    ISO-8601. In pratice, it means that it contains at least a year.
    
    Following the changes of those two commits, the date information is
    never used to create the album uri because extract_gst_date_time()
    always returns FALSE.
    
    This issue is fixed by returning TRUE if a date tag contains at least
    a year. This mimicks the behavior of the other audio extractors (ogg,
    mp3 and flac) which use tracker_date_guess() to extract a minimal
    string compatible with ISO-8601.

 src/tracker-extract/tracker-extract-gstreamer.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 826e5d135..077be7ba8 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -230,9 +230,10 @@ extract_gst_date_time (gchar       *buf,
 
        buf[0] = '\0';
 
-       if (gst_tag_list_get_date_time (tag_list, tag_date_time, &date_time)) {
+       if (gst_tag_list_get_date_time (tag_list, tag_date_time, &date_time) && gst_date_time_has_year 
(date_time)) {
                gboolean complete;
 
+               ret = TRUE;
                complete = get_gst_date_time_to_buf (date_time, buf, size);
                gst_date_time_unref (date_time);
 
@@ -240,8 +241,6 @@ extract_gst_date_time (gchar       *buf,
                        g_debug ("GstDateTime was not complete, parts of the date/time were missing (e.g. 
hours, minutes, seconds)");
                }
        } else if (gst_tag_list_get_date (tag_list, tag_date, &date)) {
-               gboolean ret = FALSE;
-
                if (date && g_date_valid (date)) {
                        if (date->julian)
                                ret = g_date_valid_julian (date->julian_days);


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