banshee r4641 - in trunk/banshee: . src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Metadata src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp



Author: gburt
Date: Wed Oct  1 19:18:47 2008
New Revision: 4641
URL: http://svn.gnome.org/viewvc/banshee?rev=4641&view=rev

Log:
2008-10-01  Gabriel Burt  <gabriel burt gmail com>

	* src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs: Use
	track.ArtworkId instead of explicitly calling CreateArtistAlbumId.

	* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs:
	Remove unused override.

	* src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs: Don't
	lookup a track if its ArtworkId is null.

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
	Don't set the AlbumArtist value if IsCompilation is false.

	* src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs: Set null ArtworkId
	if either the artist or album is unknown (BGO #549320).



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
   trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs

Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/CoverArtSpec.cs	Wed Oct  1 19:18:47 2008
@@ -30,10 +30,17 @@
 using System.IO;
 using System.Text.RegularExpressions;
 
+using Mono.Unix;
+
 namespace Banshee.Base
 {
     public static class CoverArtSpec
     {
+        private static string unknown_artist_tr = Catalog.GetString ("Unknown Artist");
+        private static string unknown_artist = "Unknown Artist";
+        private static string unknown_album_tr = Catalog.GetString ("Unknown Album");
+        private static string unknown_album = "Unknown Album";
+
         public static bool CoverExists (string artist, string album)
         {
             return CoverExists (CreateArtistAlbumId (artist, album));
@@ -46,7 +53,7 @@
         
         public static bool CoverExistsForSize (string aaid, int size)
         {
-            return File.Exists (GetPathForSize (aaid, size));
+            return aaid == null ? false : File.Exists (GetPathForSize (aaid, size));
         }
         
         public static string GetPath (string aaid)
@@ -65,12 +72,16 @@
         {
             return CreateArtistAlbumId (artist, album, false);
         }
-        
+
         public static string CreateArtistAlbumId (string artist, string album, bool asUriPart)
         {
+            if (artist == unknown_artist || artist == unknown_artist_tr || album == unknown_album || album == unknown_album_tr) {
+                return null;
+            }
+
             string sm_artist = EscapePart (artist);
             string sm_album = EscapePart (album);
-            
+
             return String.IsNullOrEmpty (sm_artist) || String.IsNullOrEmpty (sm_album)
                 ? null 
                 : String.Format ("{0}{1}{2}", sm_artist, asUriPart ? "/" : "-", sm_album); 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	Wed Oct  1 19:18:47 2008
@@ -248,6 +248,12 @@
         public override string AlbumArtist {
             get { return base.AlbumArtist; }
             set {
+                // Can't set the AlbumArtist if not a compilation, b/c its implicitly kept
+                // the same as the Track Artist
+                if (!IsCompilation) {
+                    return;
+                }
+
                 value = CleanseString (value, AlbumArtist);
                 if (value == null)
                     return;

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs	Wed Oct  1 19:18:47 2008
@@ -78,7 +78,7 @@
         
         public void Lookup (IBasicTrackInfo track, JobPriority priority)
         {
-            if (track == null || queries == null) {
+            if (track == null || queries == null || track.ArtworkId == null) {
                 return;
             }
             

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs	Wed Oct  1 19:18:47 2008
@@ -77,11 +77,6 @@
             Log.Debug (String.Format ("Migrated {0} album art images.", artwork_count));
         }
         
-        public Pixbuf Lookup (string artist, string album)
-        {
-            return Lookup (CoverArtSpec.CreateArtistAlbumId (artist, album));
-        }
-        
         public Pixbuf Lookup (string id)
         {
             return LookupScale (id, 0);

Modified: trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs	Wed Oct  1 19:18:47 2008
@@ -321,7 +321,7 @@
                     if (supports_jpegs && can_sync) {
                         try {
                             Gdk.Pixbuf pic = ServiceManager.Get<Banshee.Collection.Gui.ArtworkManager> ().LookupScale (
-                                CoverArtSpec.CreateArtistAlbumId (track.ArtistName, track.AlbumTitle), thumb_width
+                                track.ArtworkId, thumb_width
                             );
                             if (pic != null) {
                                 byte [] bytes = pic.SaveToBuffer ("jpeg");



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