[banshee] DatabaseTrackInfo: don't default to MusicFilePattern when null (bgo#689123)



commit 2c82ffbeaf4f4ff9f996b4dfaf1bfc84064353f5
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Thu Feb 28 11:26:21 2013 +0000

    DatabaseTrackInfo: don't default to MusicFilePattern when null (bgo#689123)
    
    PathPattern property was defaulting to MusicFileNamePattern in the class
    DatabaseTrackInfo, which meant that tracks of sources without a pattern
    at all would still get imported with the directory structured configured
    for music. The particular case reported in bgo#689123 is Video.

 .../DatabaseTrackInfo.cs                           |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs 
b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
index 1b5f984..e44b5aa 100644
--- a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
@@ -722,8 +722,7 @@ namespace Banshee.Collection.Database
         public PathPattern PathPattern {
             get {
                 var src = PrimarySource;
-                var pattern = src == null ? null : src.PathPattern;
-                return pattern ?? MusicLibrarySource.MusicFileNamePattern;
+                return src == null ? null : src.PathPattern;
             }
         }
 
@@ -746,7 +745,8 @@ namespace Banshee.Collection.Database
             bool in_library = old_uri.IsLocalPath ? old_uri.AbsolutePath.StartsWith 
(PrimarySource.BaseDirectoryWithSeparator) : false;
 
             if (!in_library && ((library_source.HasCopyOnImport && library_source.CopyOnImport) || 
force_copy)) {
-                string new_filename = PathPattern.BuildFull (PrimarySource.BaseDirectory, this, 
Path.GetExtension (old_uri.ToString ()));
+                string new_filename = PathPattern != null ? PathPattern.BuildFull 
(PrimarySource.BaseDirectory, this, Path.GetExtension (old_uri.ToString ()))
+                    : Path.Combine (PrimarySource.BaseDirectory, Path.GetFileName (SafeUri.UriToFilename 
(old_uri)));
                 SafeUri new_uri = new SafeUri (new_filename);
 
                 try {


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