[Banshee-List] m3u playlist importing



Hi,

Is this the place to send patches? I just started using Banshee and have been unable to import an m3u playlist at all.  Even for the simplest playlist, it would try to import the songs despite the fact that they were already in my library, and then fail to import them saying they were already in my library.

I tracked down what I think is the problem and have attached a simple patch that fixes it for me.  Basically the m3u playlist reader returns URIs, and then the ImportPlaylistWorker compares these URIs to Paths of library songs (rather than URIs), which results in them always failing to match.  I changed it to use URIs for the library songs.

This is basically my first time contributing to an open-source project, and my first time working in C#, so cut me some newbie slack :).  I also just made this fix as quickly as possible, without looking really closely at the structure of the code, so be warned.

Steve
Index: src/Core/Banshee.Base/Banshee.Playlists/PlaylistFileUtil.cs
===================================================================
--- src/Core/Banshee.Base/Banshee.Playlists/PlaylistFileUtil.cs	(revision 2577)
+++ src/Core/Banshee.Base/Banshee.Playlists/PlaylistFileUtil.cs	(working copy)
@@ -160,7 +160,7 @@
                 // import them.
                 if (!VerifyTracksInLibrary()) {
                     ImportTracksIntoLibrary();
-                }                
+                }
                 CreatePlaylist();
             } catch (PlaylistImportCanceledException) {
                 // Do nothing, user canceled import.
@@ -187,13 +187,13 @@
                 bool found_track = false;
                 
                 foreach (TrackInfo ti in LibrarySource.Instance.Tracks) {
-                    if (ti.Uri.AbsolutePath.Equals(uri)) {
+                    if (ti.Uri.AbsoluteUri.Equals(uri)) {
                         found_track = true;
                         break;
                     }
                 }
                 
-                if (!found_track) {                    
+                if (!found_track) {
                     not_found_uri_list.Add(uri);
                 }
                 
@@ -250,7 +250,7 @@
         {
             foreach (string uri in uris) {                  
                 foreach (TrackInfo ti in LibrarySource.Instance.Tracks) {
-                    if (ti.Uri.AbsolutePath.Equals(uri)) {                                
+                    if (ti.Uri.AbsoluteUri.Equals(uri)) {                                
                         track_info_list.Add(ti);                        
                         break;
                     }


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