[banshee] Fix some db migration issues
- From: Gabriel Burt <gburt src gnome org>
 
- To: svn-commits-list gnome org
 
- Cc: 
 
- Subject: [banshee] Fix some db migration issues
 
- Date: Tue, 13 Oct 2009 17:44:26 +0000 (UTC)
 
commit b7edd1864a50ec41fed29dd652f96618bf56d984
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Oct 13 10:36:43 2009 -0700
    Fix some db migration issues
 .../Banshee.Database/BansheeDbFormatMigrator.cs    |   10 +++++-----
 .../Banshee.Library/MusicLibrarySource.cs          |    7 ++++++-
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
index 780f4b6..36dd90e 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
@@ -349,10 +349,10 @@ namespace Banshee.Database
         [DatabaseVersion (7)]
         private bool Migrate_7 ()
         {
-            Execute ("UPDATE CorePrimarySources SET StringID = 'MusicLibrarySource-Library' WHERE StringID = 'Library'");
-            Execute ("UPDATE CorePrimarySources SET StringID = 'VideoLibrarySource-VideoLibrary' WHERE StringID = 'VideoLibrary'");
-            Execute ("UPDATE CorePrimarySources SET StringID = 'PodcastSource-podcasting' WHERE StringID = 'podcasting'");
-            Execute ("DELETE FROM CoreCache; DELETE FROM CoreCacheModels");
+            try { Execute ("UPDATE CorePrimarySources SET StringID = 'MusicLibrarySource-Library' WHERE StringID = 'Library'"); } catch {}
+            try { Execute ("UPDATE CorePrimarySources SET StringID = 'VideoLibrarySource-VideoLibrary' WHERE StringID = 'VideoLibrary'"); } catch {}
+            try { Execute ("UPDATE CorePrimarySources SET StringID = 'PodcastSource-podcasting' WHERE StringID = 'podcasting'"); } catch {}
+            try { Execute ("DELETE FROM CoreCache; DELETE FROM CoreCacheModels"); } catch {}
             return true;
         }
         
@@ -725,7 +725,7 @@ namespace Banshee.Database
         {
             try {
                 // Make paths not relative for Music Library items
-                string library_path = Banshee.Library.LibrarySource.OldLocationSchema.Get ();
+                string library_path = Banshee.Library.LibrarySource.OldLocationSchema.Get (Banshee.Library.MusicLibrarySource.GetDefaultBaseDirectory ());
                 if (library_path != null) {
                     int podcast_src_id = connection.Query<int> ("SELECT PrimarySourceID FROM CorePrimarySources WHERE StringID = 'PodcastSource-PodcastLibrary'");
 
diff --git a/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs b/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
index c596026..35ce580 100644
--- a/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
+++ b/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
@@ -69,9 +69,14 @@ namespace Banshee.Library
 
             PreferencesPage.Add (new Section ("misc", Catalog.GetString ("Miscellaneous"), 10));
         }
+
+        public static string GetDefaultBaseDirectory ()
+        {
+            return Banshee.Base.Paths.GetXdgDirectoryUnderHome ("XDG_MUSIC_DIR", "Music");
+        }
         
         public override string DefaultBaseDirectory {
-            get { return Banshee.Base.Paths.GetXdgDirectoryUnderHome ("XDG_MUSIC_DIR", "Music"); }
+            get { return GetDefaultBaseDirectory (); }
         }
 
         public override IEnumerable<SmartPlaylistDefinition> DefaultSmartPlaylists {
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]