banshee r4242 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources src/Extensions/Banshee.CoverArt/Banshee.CoverArt



Author: gburt
Date: Tue Jul 22 21:10:09 2008
New Revision: 4242
URL: http://svn.gnome.org/viewvc/banshee?rev=4242&view=rev

Log:
2008-07-22  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs: Add a
	UriToSafeUri method that checks to see if the uri is relative and does the
	right thing.

	* src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs: Set the
	Uri on the track object we pass to the metadata provider, fixes bug where
	the cover art extension wasn't able to use the new cover-art-in-folder
	lookup provider (BGO #544226).


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
   trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs	Tue Jul 22 21:10:09 2008
@@ -161,6 +161,18 @@
         {
             return (primary_sources.ContainsKey (id)) ? primary_sources[id] : null;
         }
+        
+        public virtual SafeUri UriToSafeUri (string uri_field)
+        {
+            if (String.IsNullOrEmpty (uri_field)) {
+                return null;
+            }
+            
+            return UriAndTypeToSafeUri (
+                uri_field[0] == System.IO.Path.DirectorySeparatorChar ? TrackUriType.AbsolutePath : TrackUriType.RelativePath,
+                uri_field
+            );
+        }
 
         public virtual SafeUri UriAndTypeToSafeUri (TrackUriType type, string uri_field)
         {

Modified: trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs	Tue Jul 22 21:10:09 2008
@@ -75,8 +75,8 @@
         ));
 
         private static HyenaSqliteCommand select_query = new HyenaSqliteCommand (String.Format (query,
-            "DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name",
-            "LIMIT ?"
+            "DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri",
+            "GROUP BY CoreAlbums.AlbumID LIMIT ?"
         ));
         
         public CoverArtJob (DateTime lastScan) : base (Catalog.GetString ("Downloading Cover Art"))
@@ -131,7 +131,10 @@
                             
                             track.AlbumTitle = reader.GetString (1);
                             track.ArtistName = reader.GetString (2);
+                            track.PrimarySource = ServiceManager.SourceManager.MusicLibrary;
+                            track.Uri = track.PrimarySource.UriToSafeUri (reader.GetString (3));
                             track.AlbumId = Convert.ToInt32 (reader[0]);
+                            //Console.WriteLine ("have album {0}/{1} for track uri {2}", track.AlbumId, track.AlbumTitle, track.Uri);
 
                             Progress = (double) current / (double) total;
                             Status = String.Format (Catalog.GetString ("{0} - {1}"), track.ArtistName, track.AlbumTitle);



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