[tracker-miners: 2/4] tracker-extract-libav: Use 'date' instead of 'creation_time' for ffmpeg music indexing.



commit deee7d3b0829ca7f463f853375f8092661f17933
Author: Andrew Branson <andrew branson jolla com>
Date:   Fri Apr 17 13:06:29 2020 +0200

    tracker-extract-libav: Use 'date' instead of 'creation_time' for ffmpeg music indexing.
    
    Only use ffmpeg 'creation_time' tag for video indexing. For music files, this will be the timestamp of 
when the file was ripped rather than the year of release of the album, and will cause each track to get 
indexed in its own separate album.

 src/tracker-extract/tracker-extract-libav.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-libav.c b/src/tracker-extract/tracker-extract-libav.c
index 010c8e678..3dcbae66d 100644
--- a/src/tracker-extract/tracker-extract-libav.c
+++ b/src/tracker-extract/tracker-extract-libav.c
@@ -90,13 +90,6 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 
        metadata = tracker_resource_new (NULL);
 
-       if ((tag = av_dict_get (format->metadata, "creation_time", NULL, 0))) {
-               content_created = tracker_date_guess (tag->value);
-               if (content_created) {
-                       tracker_resource_set_string (metadata, "nie:contentCreated", content_created);
-               }
-       }
-
        if (audio_stream) {
                if (audio_stream->codec->sample_rate > 0) {
                        tracker_resource_set_int64 (metadata, "nfo:sampleRate", 
audio_stream->codec->sample_rate);
@@ -148,6 +141,13 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                        tracker_resource_set_int64 (metadata, "nmm:season", atoi(tag->value));
                }
 
+               if ((tag = av_dict_get (format->metadata, "creation_time", NULL, 0))) {
+                       content_created = tracker_date_guess (tag->value);
+                       if (content_created) {
+                               tracker_resource_set_string (metadata, "nie:contentCreated", content_created);
+                       }
+               }
+
        } else if (audio_stream) {
                TrackerResource *album_artist = NULL, *performer = NULL;
                char *album_artist_name = NULL;
@@ -186,6 +186,13 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                        performer = tracker_extract_new_artist (tag->value);
                }
 
+               if ((tag = av_dict_get (format->metadata, "date", NULL, 0))) {
+                       content_created = tracker_date_guess (tag->value);
+                       if (content_created) {
+                               tracker_resource_set_string (metadata, "nie:contentCreated", content_created);
+                       }
+               }
+
                if (performer) {
                        tracker_resource_set_relation (metadata, "nmm:performer", performer);
                }


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