After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 723020 - Rhythmbox incorrectly reads the year tag of m4a files
Rhythmbox incorrectly reads the year tag of m4a files
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: User Interface
3.0
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-26 14:28 UTC by Jean-René Bastien
Modified: 2014-07-25 13:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
example audio file (100.51 KB, audio/mp4)
2014-05-29 21:56 UTC, foss.freedom
Details
second example audio file showing the issue at hand (125.42 KB, audio/mp4)
2014-05-30 20:57 UTC, foss.freedom
Details
quick python application to display the tags of an audio file (2.13 KB, text/x-python)
2014-05-31 10:59 UTC, foss.freedom
Details

Description Jean-René Bastien 2014-01-26 14:28:09 UTC
The year tags is incorrectly read by Rhythmbox on m4a files.  With the attached file, Nautilus shows 2012 which is correct.  RB reports an unknown year.

When trying to correct the year in RB, an error message pops up "Error while saving song information, Downstream is not seekable and headers can't be rewritten"

This error was reported as fixed on Launchpad but does not seem to handle the m4a files well:  "https://bugs.launchpad.net/ubuntu/+source/rhythmbox/+bug/1155575

This bug affects Ubuntu version 13.04 to 13.10 and RB 2.97 to 3.0.
Comment 1 Jean-René Bastien 2014-01-27 14:05:06 UTC
Sorry for size and copyright reason, just ask me for the attachment and I will email it to you.
Comment 2 foss.freedom 2014-05-29 21:56:31 UTC
Created attachment 277493 [details]
example audio file

example audio file (4secs) - nautilus shows this as 2012 whereas rhythmbox shows this as Unknown
Comment 3 foss.freedom 2014-05-29 21:59:23 UTC
Hi - I've add a very short snippet of music showing this issue.

EasyTag shows the correct year (2012)

didnt see anything obvious when running rhythmbox -d

Is there any extra tracing I can add to see where rhythmbox is extracting the year as "unknown"?
Comment 4 Jonathan Matthew 2014-05-30 12:40:33 UTC
commit 1d921b4 fixes reading of dates from mp4.  gstreamer's mp4mux element doesn't seem to be working properly for me, so mp4 tag writing doesn't work.  I'm probably not going to be able to look into that for a while.
Comment 5 foss.freedom 2014-05-30 20:57:44 UTC
Created attachment 277586 [details]
second example audio file showing the issue at hand

second sample (4 seconds) - as described, this time the year is reported as 1910 but nautilus says 2012
Comment 6 foss.freedom 2014-05-30 20:59:41 UTC
Hi Jonathan,

  indeed, this commit has fixed the "unknown" vs 2012 issue.  Thats good :)

I have, however, got another sample of music - this time, rhythmbox reports 1910 but Nautilus and EasyTag reports the year as 2012
Comment 7 Jonathan Matthew 2014-05-31 02:12:37 UTC
gstreamer reads that one incorrectly.  Please file a new bug against gstreamer and attach the file.
Comment 8 foss.freedom 2014-05-31 07:08:22 UTC
thanks - filed here: https://bugzilla.gnome.org/show_bug.cgi?id=731029
Comment 9 foss.freedom 2014-05-31 10:59:04 UTC
Jonathan,

  just a quick update - I scratched together a python app to read and display the tags - using the gstreamer ElementFactory "playbin" - the date field is correctly extracted as 2012

For m4a files - what ElementFactory is rhythmbox using to extract tag information?

N.B. - if you want to run the app in the attachment the syntax is

python find_tags.py /full/path/to/the/attachment.m4a
Comment 10 foss.freedom 2014-05-31 10:59:44 UTC
Created attachment 277615 [details]
quick python application to display the tags of an audio file
Comment 11 Jonathan Matthew 2014-05-31 11:11:55 UTC
The problem here is that reading this file results in both GST_TAG_DATE and GST_TAG_DATE_TIME tags, where the date time is correct (2012) and the datetime tag is apparently not (1910).  rhythmbox arbitrarily takes the datetime tag in preference to the date tag, so it shows the date as 1910.

if you're interested in the details of how rhythmbox processes tags: https://git.gnome.org/browse/rhythmbox/tree/metadata/rb-metadata-gst.c
Comment 12 Jean-René Bastien 2014-05-31 12:46:29 UTC
That would explain why not all of my m4a files have invalid date.  Any album purchased on iTunes after 2011 have a wrong date.  I guess that they started using the GST_TAG_TIME tag at that period.

But why not change Rhythmbox given Nautilus, EasyTag, Clementine all show the correct year?
Comment 13 foss.freedom 2014-05-31 13:15:36 UTC
The code is generic at this stage - trying to catch dates and datetimes from multiple audio types.

There is definitely something different between python pulling a datetime and the C equivalent.

Python throws this error when trying to pull the date into a datetime

(python:3127): GStreamer-CRITICAL **: gst_tag_list_get_date_time: assertion 'GST_VALUE_HOLDS_DATE_TIME (&v)' failed

Gst.TagList.get_datetime(tag) in python returns False for this m4a file ... so in theory should drop into the get_date else clause and return the correct year.

The C API and Python API is acting differently - dunno why though.  

Its left me scratching my head.
Comment 14 foss.freedom 2014-05-31 18:14:02 UTC
@Jonathan,

  can I ask why the logic is datetime first before date? - if you reverse the logic, the two m4a files above are correct.  

I've mainly got ogg files in my collection.  A quick spot check - they remain correct.  I've checked the few mp3 and flac files in my collection - they remain correct.

i.e.

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,
					gst_date_time_has_month (datetime) ? gst_date_time_get_month (datetime) : 1,
					gst_date_time_get_year (datetime));

			g_value_init (ret, G_TYPE_ULONG);
			g_value_set_ulong (ret, g_date_get_julian (&date));

			gst_date_time_unref (datetime);
			return TRUE;
		} else {
			return FALSE;
		}
Comment 15 Jonathan Matthew 2014-05-31 23:40:09 UTC
like I said, it's arbitrary.  I'm not changing it without understanding where these apparently wrong datetime tags come from.
Comment 16 Jean-René Bastien 2014-07-25 13:08:57 UTC
I see that it is now set to "resolved".  I haven't seen a commit since May 30th regarding this but if I can help with the testing, let me know.  If you have something already compiled for Ubuntu 14.04 that would be even better as my compiling skills are limited.