[banshee/stable-2.0] AudioCd: Fix metadata fetching with multiple results (bgo#587264)



commit d6274af6f2a0240d16854b9c78a0175bada255ec
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat May 28 16:21:20 2011 +0200

    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.

 .../Banshee.AudioCd/AudioCdDiscModel.cs            |    9 +++++++--
 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 51a35d0..2e7a7db 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;
                 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]