summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Lorentz <bertrand.lorentz@gmail.com>2011-05-28 16:21:20 +0200
committerBertrand Lorentz <bertrand.lorentz@gmail.com>2011-05-28 16:36:55 +0200
commitee467bdcf9fe97ed161deef3c5108d2bf5f54db5 (patch)
treee7630a7861038ae7b739a5aeb37ab2c5ab0e0b66
parent0065ab68525456b9e7c51e26978623fe629f8e20 (diff)
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.
-rw-r--r--src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs b/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
index 51a35d0da..2e7a7dbbb 100644
--- a/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
+++ b/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
@@ -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;
}