Bug 300091 - Year field not set when retrieving from MusicBrainz
Summary: Year field not set when retrieving from MusicBrainz
Alias: None
Product: libkcddb
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Richard Lärkäng
Depends on:
Reported: 2012-05-15 20:11 UTC by Bill Good
Modified: 2012-06-05 19:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Bill Good 2012-05-15 20:11:47 UTC
Building from kdemultimedia-4.8.3 sources (with Arch Linux packager).

When querying MusicBrainz with libkcddb, the year field isn't set. MusicBrainz contains a date field, so it's not for lack of MusicBrainz support. The CDInfo Year attribute isn't set in MusicBrainzLookup::lookup.

I started working on a patch, but discovered that the libmusicbrainz3 MusicBrainz::Release class that's used returns a list of events (http://users.musicbrainz.org/~luks/docs/libmusicbrainz3/class_music_brainz_1_1_release.html#adfa747f1d0836c5905ac90ce63dba9fb) instead of a single date. This makes sense, as an album could be released at different times in different locales. This raises the question of how to pick an arbitrary date to use for its year as our single year attribute.

My thought is to simply take the earliest date and use its year. Would that be acceptable? I'm not sure how else to handle it, short of user input. I suspect it would be fairly accurate...

Reproducible: Always
Comment 1 Richard Lärkäng 2012-05-15 20:38:37 UTC
Your solution with choosing the earliest year would have been fine.
However, libmusicbrainz 3 is not working very well with the new schema introduced last year, so in the next release of KDE (4.9), I have updated libkcddb to use the new libmusicbrainz 4 instead.
I believe in the new schema, only one release date per release is possible, which would make the problem you describe go away.

I would guess the CRelease::Date() only returns one date.
However, since it's a string I think it might return a full date, and not just a year (as a test case, you might try for example http://musicbrainz.org/release/04319e80-0948-4e89-8180-7cf6f17fc77a )

If you want to give it a try to write a patch, you are very welcome to do so, just ask if you have any questions. Otherwise, I might try to take a look at it, but it might take some time getting around to doing it. Since it should use libmusicbrainz 4, you should start from the code at
https://projects.kde.org/projects/kde/kdemultimedia/libkcddb/repository (the 'master' branch)
if you want to give it a try.
Comment 2 Richard Lärkäng 2012-06-05 19:56:21 UTC
Git commit a2d2a670fb5ac1a733f35b3358d00b8981a4a459 by Richard Lärkäng.
Committed on 05/06/2012 at 21:45.
Pushed by larkang into branch 'master'.

Read year on Musicbrainz lookups

Add code for reading the year when looking up releases from Musicbrainz.
Added a test-case (musicbrainztest-fulldata), where the date
is "2011-04-29", which should be parsed as only "2011".

Also, while adding the test case, I ran into a bug, the titles
and track artists were always taken from the recording, while
ones from the "release credits" are preferred, fixed this as well,
and updated the other tests to reflect the fixes.

M  +25   -10   libkcddb/musicbrainz/musicbrainzlookup.cpp
M  +1    -0    test/CMakeLists.txt
M  +4    -4    test/asyncmusicbrainztest.cpp
A  +157  -0    test/musicbrainztest-fulldate.cpp     [License: LGPL (v2+)]
A  +32   -0    test/musicbrainztest-fulldate.h     [License: LGPL (v2+)]
M  +7    -7    test/musicbrainztest-severaldiscs.cpp
M  +3    -3    test/musicbrainztest.cpp