[banshee] Fix blank MimeTypes for tracks ripped before 1.4



commit 4ad77f5fa485fd6014e109bccf1e1f88c3bb7a22
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Jun 2 16:26:50 2009 -0500

    Fix blank MimeTypes for tracks ripped before 1.4
    
    Fixes issue with not being able to transfer such tracks to
    devices (BGO #536590)
---
 .../Banshee.Database/BansheeDbFormatMigrator.cs    |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
index 19cdbce..47e22f8 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
@@ -56,7 +56,7 @@ namespace Banshee.Database
         // NOTE: Whenever there is a change in ANY of the database schema,
         //       this version MUST be incremented and a migration method
         //       MUST be supplied to match the new version number
-        protected const int CURRENT_VERSION = 32;
+        protected const int CURRENT_VERSION = 33;
         protected const int CURRENT_METADATA_VERSION = 6;
         
 #region Migration Driver
@@ -761,6 +761,23 @@ namespace Banshee.Database
         
 #endregion
 
+#region Version 33
+
+        [DatabaseVersion (33)]
+        private bool Migrate_33 ()
+        {
+            // We used to have a bug where MimeType didn't get set for tracks we ripped,
+            // so set any blank ones now.  See BGO #536590
+            foreach (var ext in new string [] {"mp3", "ogg", "flac", "aac", "oga", "wma", "wm"}) {
+                Execute (String.Format (
+                    "UPDATE CoreTracks SET MimeType = 'taglib/{0}' WHERE PrimarySourceId = 1 AND (MimeType IS NULL OR MimeType = '') AND Uri LIKE '%.{0}'", ext
+                ));
+            }
+            return true;
+        }
+
+#endregion
+
 #pragma warning restore 0169
         
 #region Fresh database setup



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