[banshee/stable-1.8] [CoverArtSpec] Return null for unknown artists



commit b2bc996eee8a436921b94b7ef608332ea413af12
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Mon Nov 1 16:35:29 2010 -0500

    [CoverArtSpec] Return null for unknown artists
    
    Fixes bug with displaying some random image for the "All Albums (N)"
    album browser entry (bgo#620010)

 src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs |    9 ++++-----
 .../Banshee.Base/Tests/CoverArtSpecTests.cs        |    4 ++++
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs b/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs
index a4f8690..3ab2849 100644
--- a/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs
+++ b/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs
@@ -87,17 +87,16 @@ namespace Banshee.Base
 
         public static string CreateArtistAlbumId (string artist, string album)
         {
-            if (album == unknown_album || album == unknown_album_tr) {
+            if (album == null || album == unknown_album || album == unknown_album_tr) {
                 // do not attempt to group unknown album tracks together
                 return null;
             }
 
-            if (artist == unknown_artist || artist == unknown_artist_tr) {
-                artist = null;
+            if (artist == null || artist == unknown_artist || artist == unknown_artist_tr) {
+                return null;
             }
 
-            string digestible = String.Format ("{0}\t{1}", artist ?? "", album ?? "");
-
+            string digestible = String.Format ("{0}\t{1}", artist, album);
             return String.Format ("album-{0}", Digest (digestible));
         }
 
diff --git a/src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs b/src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs
index 25f2dbb..8784c65 100644
--- a/src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs
+++ b/src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs
@@ -47,6 +47,10 @@ namespace Banshee.Base.Tests
             AssertDigested (null, null);
             AssertDigested ("", null);
             AssertDigested (" ", "7215ee9c7d9dc229d2921a40e899ec5f");
+
+            // Test that bgo#620010 is fixed
+            Assert.AreEqual (null, CoverArtSpec.CreateArtistAlbumId (null, null));
+            Assert.AreEqual (null, CoverArtSpec.CreateArtistAlbumId (null, "All Albums (6)"));
         }
 
         [Test]



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