Commit ee467bdc authored by Bertrand Lorentz's avatar Bertrand Lorentz

AudioCd: Fix metadata fetching with multiple results (bgo#587264)

When looking for CD metadata on MusicBrainz, we were looking for a
perfect match: only one release with a score of 100. If the search
returned more than one result with a score of 100, we would reject all
results.
MusicBrainz recently started to return multiple releases much more
often, causing our metadata fetching to fail quite a lot.

We now use the first result if it has a score of 100, ignoring any other
results.

This also fixes a NRE when no results were found.
parent 0065ab68
......@@ -123,10 +123,15 @@ namespace Banshee.AudioCd
OnMetadataQueryStarted (mb_disc);
Release release = Release.Query (mb_disc).PerfectMatch ();
Release release = Release.Query (mb_disc).First ();
if (release == null || release.Score < 100) {
OnMetadataQueryFinished (false);
return;
}
var tracks = release.GetTracks ();
if (release == null || tracks.Count != Count) {
if (tracks.Count != Count) {
OnMetadataQueryFinished (false);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment