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



Author: gburt
Date: Tue Sep  9 22:15:07 2008
New Revision: 4503
URL: http://svn.gnome.org/viewvc/banshee?rev=4503&view=rev

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

	* src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs: 
	* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs: Fix bug with
	improperly getting the Uri of some tracks when fetching cover art (BGO
	#546234).



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 Sep  9 22:15:07 2008
@@ -169,18 +169,6 @@
             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)
         {
             if (type == TrackUriType.RelativePath && BaseDirectory != null)

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 Sep  9 22:15:07 2008
@@ -29,7 +29,6 @@
 
 using System;
 using System.Collections.Generic;
-using System.Data;
 using System.IO;
 using System.Threading;
 
@@ -68,7 +67,7 @@
                         LastAttempt > ? OR Downloaded = 1)");
 
         private static HyenaSqliteCommand select_query = new HyenaSqliteCommand (@"
-            SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri
+            SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri, CoreTracks.UriType
             FROM CoreTracks, CoreArtists, CoreAlbums
             WHERE
                 CoreTracks.PrimarySourceID = ? AND
@@ -100,11 +99,11 @@
             Scheduler.Schedule (this, JobPriority.Lowest);
         }
 
-        private IDataReader RunQuery ()
+        private HyenaDataReader RunQuery ()
         {
-            return ServiceManager.DbConnection.Query (select_query,
+            return new HyenaDataReader (ServiceManager.DbConnection.Query (select_query,
                 ServiceManager.SourceManager.MusicLibrary.DbId, last_scan, last_scan - retry_every, BatchSize
-            );
+            ));
         }
         
         public void Run ()
@@ -123,18 +122,18 @@
                         break;
                     }
 
-                    using (IDataReader reader = RunQuery ()) {
+                    using (HyenaDataReader reader = RunQuery ()) {
                         while (reader.Read ()) {
                             if (IsCancelRequested) {
                                 Finish ();
                                 return;
                             }
                             
-                            track.AlbumTitle = reader.GetString (1);
-                            track.ArtistName = reader.GetString (2);
+                            track.AlbumTitle = reader.Get<string> (1);
+                            track.ArtistName = reader.Get<string> (2);
                             track.PrimarySource = ServiceManager.SourceManager.MusicLibrary;
-                            track.Uri = track.PrimarySource.UriToSafeUri (reader.GetString (3));
-                            track.AlbumId = Convert.ToInt32 (reader[0]);
+                            track.Uri = track.PrimarySource.UriAndTypeToSafeUri (reader.Get<TrackUriType> (4), reader.Get<string> (3));
+                            track.AlbumId = reader.Get<int> (0);
                             //Console.WriteLine ("have album {0}/{1} for track uri {2}", track.AlbumId, track.AlbumTitle, track.Uri);
 
                             Progress = (double) current / (double) total;



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