banshee r4867 - in trunk/banshee: . src/Core/Banshee.Core/Banshee.Streaming src/Core/Banshee.Services/Banshee.Collection.Database



Author: gburt
Date: Mon Dec 29 20:36:08 2008
New Revision: 4867
URL: http://svn.gnome.org/viewvc/banshee?rev=4867&view=rev

Log:
2008-12-29  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs: 
	Patch from John Millikin fixing issue with an album sometimes being listed
	twice, once as a compilation album and once not (BGO #557313)

	* src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs: Add some notes
	in a comment.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs

Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs	Mon Dec 29 20:36:08 2008
@@ -181,6 +181,9 @@
             if (apple_tag != null && apple_tag.IsCompilation)
                 return true;
             
+            // FIXME the FirstAlbumArtist != FirstPerformer check might return true for half the
+            // tracks on a compilation album, but false for some
+            // TODO checked for 'Soundtrack' (and translated) in the title?
             if (tag.Performers.Length > 0 && tag.AlbumArtists.Length > 0 &&
                 (tag.Performers.Length != tag.AlbumArtists.Length || tag.FirstAlbumArtist != tag.FirstPerformer)) {
                 return true;

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs	Mon Dec 29 20:36:08 2008
@@ -50,7 +50,7 @@
         }
 
         private static HyenaSqliteCommand select_command = new HyenaSqliteCommand (String.Format (
-            "SELECT {0} FROM {1} WHERE {2} AND CoreAlbums.ArtistID = ? AND CoreAlbums.Title = ? AND CoreAlbums.IsCompilation = ?",
+            "SELECT {0} FROM {1} WHERE {2} AND CoreAlbums.ArtistID = ? AND CoreAlbums.Title = ?",
             provider.Select, provider.From,
             (String.IsNullOrEmpty (provider.Where) ? "1=1" : provider.Where)
         ));
@@ -63,7 +63,6 @@
 
         private static int last_artist_id;
         private static string last_title;
-        private static bool last_compilation;
         private static DatabaseAlbumInfo last_album;
         
         public static void Reset ()
@@ -83,7 +82,7 @@
 
         public static DatabaseAlbumInfo FindOrCreate (DatabaseArtistInfo artist, DatabaseAlbumInfo album)
         {
-            if (album.Title == last_title && artist.DbId == last_artist_id && last_album != null && last_compilation == album.IsCompilation) {
+            if (album.Title == last_title && artist.DbId == last_artist_id && last_album != null) {
                 return last_album;
             }
 
@@ -91,12 +90,24 @@
                 album.Title = Catalog.GetString ("Unknown Album");
             }
 
-            using (IDataReader reader = ServiceManager.DbConnection.Query (select_command, artist.DbId, album.Title, album.IsCompilation)) {
+            using (IDataReader reader = ServiceManager.DbConnection.Query (select_command, artist.DbId, album.Title)) {
                 if (reader.Read ()) {
+                    bool save = false;
                     last_album = provider.Load (reader);
+
                     // If the artist name has changed since last time (but it's the same artist) then update our copy of the ArtistName
                     if (last_album.ArtistName != artist.Name) {
                         last_album.ArtistName = artist.Name;
+                        save = true;
+                    }
+                    
+                    // If the album IsCompilation status has changed, update the saved album info
+                    if (last_album.IsCompilation != album.IsCompilation) {
+                        last_album.IsCompilation = album.IsCompilation;
+                        save = true;
+                    }
+
+                    if (save) {
                         last_album.Save ();
                     }
                 } else {
@@ -109,7 +120,6 @@
             
             last_title = album.Title;
             last_artist_id = artist.DbId;
-            last_compilation = album.IsCompilation;
             return last_album;
         }
 



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