[banshee] Set track cover art if available. (bgo#627945)



commit f415b0c78823f635b738c37c56be7f66ff78349f
Author: Jensen Somers <jensen somers gmail com>
Date:   Sun Aug 29 23:51:19 2010 +0200

    Set track cover art if available. (bgo#627945)

 .../AppleDeviceTrackInfo.cs                        |   35 ++++---------------
 1 files changed, 8 insertions(+), 27 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs
index 3445ec9..d9d71bc 100644
--- a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs
+++ b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs
@@ -255,34 +255,15 @@ namespace Banshee.Dap.AppleDevice
                 database.CopyTrackToIPod (track, Uri.LocalPath);
                 ExternalId = (long) IpodTrack.DBID;
             }
-//            if (CoverArtSpec.CoverExists (ArtworkId)) {
-//                SetIpodCoverArt (device, track, CoverArtSpec.GetPath (ArtworkId));
-//            }
-        }
 
-        // FIXME: No reason for this to use GdkPixbuf - the file is on disk already in
-        // the artwork cache as a JPEG, so just shove the bytes from disk into the track
-        public static void SetIpodCoverArt (GPod.Device device, GPod.Track track, string path)
-        {
-//            try {
-//                Gdk.Pixbuf pixbuf = null;
-//                foreach (IPod.ArtworkFormat format in device.LookupArtworkFormats (IPod.ArtworkUsage.Cover)) {
-//                    if (!track.HasCoverArt (format)) {
-//                        // Lazily load the pixbuf
-//                        if (pixbuf == null) {
-//                            pixbuf = new Gdk.Pixbuf (path);
-//                        }
-//
-//                        track.SetCoverArt (format, IPod.ArtworkHelpers.ToBytes (format, pixbuf));
-//                    }
-//                }
-//
-//                if (pixbuf != null) {
-//                    pixbuf.Dispose ();
-//                }
-//            } catch (Exception e) {
-//                Log.Exception (String.Format ("Failed to set cover art on iPod from {0}", path), e);
-//            }
+            if (CoverArtSpec.CoverExists (ArtworkId)) {
+                string path = CoverArtSpec.GetPath (ArtworkId);
+                if (!track.ThumbnailsSet (path)) {
+                    Log.Error (String.Format ("Could not set cover art for {0}.", path));
+                }
+            } else {
+                track.ThumbnailsRemoveAll ();
+            }
         }
     }
 }



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