[tracker-miners/wip/jfelder/gstreamer-extractor-album-date: 2/2] tracker-extract-gstreamer: Correctly use the date for album uri
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/jfelder/gstreamer-extractor-album-date: 2/2] tracker-extract-gstreamer: Correctly use the date for album uri
- Date: Sun, 24 May 2020 23:36:14 +0000 (UTC)
commit fd84f79989e1142cdf4956a0180f75cf442fced4
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 ++---
tests/functional-tests/extractor-flac-cuesheet.py | 10 +++++-----
.../test-extraction-data/audio/flac-musicbrainz.expected.json | 4 ++--
.../test-extraction-data/audio/flac.expected.json | 4 ++--
4 files changed, 11 insertions(+), 12 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);
diff --git a/tests/functional-tests/extractor-flac-cuesheet.py
b/tests/functional-tests/extractor-flac-cuesheet.py
index 9ea446ad5..74e16fd4b 100755
--- a/tests/functional-tests/extractor-flac-cuesheet.py
+++ b/tests/functional-tests/extractor-flac-cuesheet.py
@@ -40,8 +40,8 @@ class FlacCuesheetTest(fixtures.TrackerExtractTestCase):
'nie:title': 'Only Shallow',
'nmm:trackNumber': 1,
'nfo:sampleRate': 44100,
- 'nmm:musicAlbum': 'urn:album:Loveless:My%20Bloody%20Valentine',
- 'nmm:musicAlbumDisc': 'urn:album-disc:Loveless:My%20Bloody%20Valentine:Disc1',
+ 'nmm:musicAlbum': 'urn:album:Loveless:My%20Bloody%20Valentine:1991-01-01T00:00:00Z',
+ 'nmm:musicAlbumDisc':
'urn:album-disc:Loveless:My%20Bloody%20Valentine:1991-01-01T00:00:00Z:Disc1',
'nie:isStoredAs': {
'@id': audio_uri,
'nie:interpretedAs': [
@@ -55,16 +55,16 @@ class FlacCuesheetTest(fixtures.TrackerExtractTestCase):
'nie:isStoredAs': audio_uri,
'nie:title': 'Loomer',
'nmm:musicAlbum': {
- '@id': 'urn:album:Loveless:My%20Bloody%20Valentine',
+ '@id': 'urn:album:Loveless:My%20Bloody%20Valentine:1991-01-01T00:00:00Z',
'nie:title': 'Loveless',
'nmm:albumTrackCount': 2,
'@type': 'nmm:MusicAlbum',
'nmm:albumArtist': ['urn:artist:My%20Bloody%20Valentine']
},
'nmm:musicAlbumDisc': {
- '@id': 'urn:album-disc:Loveless:My%20Bloody%20Valentine:Disc1',
+ '@id':
'urn:album-disc:Loveless:My%20Bloody%20Valentine:1991-01-01T00:00:00Z:Disc1',
'nmm:setNumber': 1,
- 'nmm:albumDiscAlbum': 'urn:album:Loveless:My%20Bloody%20Valentine',
+ 'nmm:albumDiscAlbum':
'urn:album:Loveless:My%20Bloody%20Valentine:1991-01-01T00:00:00Z',
'@type': 'nmm:MusicAlbumDisc'
}
}
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 43ffa833d..b74fb19ff 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
@@ -17,7 +17,7 @@
"nie:title": "track title",
"nmm:trackNumber": "12",
"nmm:musicAlbum": {
- "@id": "urn:album:awesome%20album:my%20album%20artist",
+ "@id": "urn:album:awesome%20album:my%20album%20artist:2020-01-01T00:00:00+00:00",
"@type": "nmm:MusicAlbum",
"nie:title": "awesome album",
"nmm:albumTrackCount": "28",
@@ -43,7 +43,7 @@
]
},
"nmm:musicAlbumDisc": {
- "@id": "urn:album-disc:awesome%20album:my%20album%20artist:Disc1",
+ "@id": "urn:album-disc:awesome%20album:my%20album%20artist:2020-01-01T00:00:00+00:00:Disc1",
"@type": "nmm:MusicAlbumDisc",
"nmm:setNumber": 1
},
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 027b719c4..92667951f 100644
--- a/tests/functional-tests/test-extraction-data/audio/flac.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/flac.expected.json
@@ -17,7 +17,7 @@
"nie:title": "track title",
"nmm:trackNumber": "12",
"nmm:musicAlbum": {
- "@id": "urn:album:awesome%20album:my%20album%20artist",
+ "@id": "urn:album:awesome%20album:my%20album%20artist:2020-01-01T00:00:00+00:00",
"@type": "nmm:MusicAlbum",
"nie:title": "awesome album",
"nmm:albumTrackCount": "28",
@@ -37,7 +37,7 @@
]
},
"nmm:musicAlbumDisc": {
- "@id": "urn:album-disc:awesome%20album:my%20album%20artist:Disc1",
+ "@id": "urn:album-disc:awesome%20album:my%20album%20artist:2020-01-01T00:00:00+00:00:Disc1",
"@type": "nmm:MusicAlbumDisc",
"nmm:setNumber": 1
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]