banshee r3852 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp src/Extensions/Banshee.PlayQueue src/Extensions/Banshee.PlayQueue/Resources src/Libraries/Hyena/Hyena src/Libraries/Lastfm/Lastfm



Author: gburt
Date: Wed Apr 30 22:26:23 2008
New Revision: 3852
URL: http://svn.gnome.org/viewvc/banshee?rev=3852&view=rev

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

	* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
	Don't begin/commit a transaction or run InnerMigrate if the version is
	current.  Use Hyena.Log instead of WriteLines.

	* src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs: Got rid
	of unnecessary if.

	* src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs: Add
	better logging for when a required service fails to start.

	* src/Core/Banshee.Services/Banshee.SmartPlaylist/Migrator.cs:

	* src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs: Dispose all
	non-extension sources and their children, but don't dispose extension
	sources.

	* src/Extensions/Banshee.PlayQueue/Makefile.am:
	* src/Extensions/Banshee.PlayQueue/Resources/Banshee.PlayQueue.addin.xml:
	Move addin.xml file up from Resources

	* src/Libraries/Hyena/Hyena/Log.cs: Make showUser default to false
	everywhere.

	* src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs:
	* src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs:
	* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs:
	* src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs:
	* src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs:
	* src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs:
	Explicitly set showUser = true.


Added:
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue.addin.xml   (props changed)
      - copied unchanged from r3850, /trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/Banshee.PlayQueue.addin.xml
Removed:
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/Banshee.PlayQueue.addin.xml
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/Migrator.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs
   trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am
   trunk/banshee/src/Libraries/Hyena/Hyena/Log.cs
   trunk/banshee/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs	Wed Apr 30 22:26:23 2008
@@ -128,19 +128,21 @@
         public void Migrate ()
         {
             try {
-                Execute ("BEGIN");
-                InnerMigrate ();
-                Execute ("COMMIT");
+                if (DatabaseVersion < CURRENT_VERSION) {
+                    Execute ("BEGIN");
+                    InnerMigrate ();
+                    Execute ("COMMIT");
+                }
 
                 // Trigger metadata refreshes if necessary
                 int metadata_version = connection.Query<int> ("SELECT Value FROM CoreConfiguration WHERE Key = 'MetadataVersion'");
                 if (DatabaseVersion == CURRENT_VERSION && metadata_version < CURRENT_METADATA_VERSION) {
                     ServiceManager.ServiceStarted += OnServiceStarted;
                 }
-            } catch (Exception e) {
-                Console.WriteLine ("Rolling back transaction");
-                Console.WriteLine (e);
+            } catch (Exception) {
+                Log.Warning ("Rolling back migration");
                 Execute ("ROLLBACK");
+                throw;
             }
 
             OnFinished ();
@@ -152,6 +154,7 @@
             bool terminate = false;
             bool ran_migration_step = false;
             
+            Log.DebugFormat ("Migrating from database version {0} to {1}", DatabaseVersion, CURRENT_VERSION);
             for (int i = DatabaseVersion + 1; i <= CURRENT_VERSION; i++) {
                 foreach (MethodInfo method in methods) {
                     foreach (DatabaseVersionAttribute attr in method.GetCustomAttributes (

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs	Wed Apr 30 22:26:23 2008
@@ -290,7 +290,7 @@
                 OpenCheck (track);
                 active_engine.Play ();
             } catch (Exception e) {
-                Log.Error (Catalog.GetString ("Problem with Player Engine"), e.Message);
+                Log.Error (Catalog.GetString ("Problem with Player Engine"), e.Message, true);
                 Close ();
                 ActiveEngine = default_engine;
             }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs	Wed Apr 30 22:26:23 2008
@@ -79,12 +79,10 @@
                 Banshee.Base.Paths.InstalledApplicationDataRoot, "locale"));
 
             ServiceManager.Run ();
-            
-            if (ServiceManager.SourceManager != null) {
-                ServiceManager.SourceManager.AddSource (new MusicLibrarySource (), true);
-                ServiceManager.SourceManager.AddSource (new VideoLibrarySource (), false);
-                ServiceManager.SourceManager.LoadExtensionSources ();
-            }
+
+            ServiceManager.SourceManager.AddSource (new MusicLibrarySource (), true);
+            ServiceManager.SourceManager.AddSource (new VideoLibrarySource (), false);
+            ServiceManager.SourceManager.LoadExtensionSources ();
             
             Banshee.Base.PlatformHacks.RestoreMonoJitSegv ();
         }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	Wed Apr 30 22:26:23 2008
@@ -127,12 +127,14 @@
                         }
                     } catch (Exception e) {
                         if (service is IRequiredService) {
+                            Log.ErrorFormat ("Error initializing required service {0}",
+                                    service == null ? type.ToString () : service.ServiceName, false);
                             throw;
                         }
                         
-                        Log.Exception (e.InnerException ?? e);
                         Log.Warning (String.Format ("Service `{0}' not started: {1}", type.FullName, 
                             e.InnerException != null ? e.InnerException.Message : e.Message));
+                        Log.Exception (e.InnerException ?? e);
                     }
                 }
                 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/Migrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/Migrator.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/Migrator.cs	Wed Apr 30 22:26:23 2008
@@ -77,7 +77,7 @@
                 ServiceManager.DbConnection.Execute ("ROLLBACK");
                 Log.Error (
                     Catalog.GetString ("Unable to Migrate Smart Playlists"),
-                    String.Format (Catalog.GetString ("Please file a bug with this error: {0}"), e.ToString ())
+                    String.Format (Catalog.GetString ("Please file a bug with this error: {0}"), e.ToString ()), true
                 );
                 return false;
             }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs	Wed Apr 30 22:26:23 2008
@@ -49,7 +49,7 @@
         public int Position;
     }
     
-    public class SourceManager : ISourceManager, IRequiredService, IDisposable
+    public class SourceManager : ISourceManager, IInitializeService, IRequiredService, IDisposable
     {
         private List<Source> sources = new List<Source>();
         private Dictionary<string, Source> extension_sources = new Dictionary<string, Source> ();
@@ -64,6 +64,14 @@
         public event SourceEventHandler SourceRemoved;
         public event SourceEventHandler ActiveSourceChanged;
 
+        public void Initialize ()
+        {
+            // TODO should add library sources here, but requires changing quite a few
+            // things that depend on being loaded before the music library is added.
+            //AddSource (music_library = new MusicLibrarySource (), true);
+            //AddSource (video_library = new VideoLibrarySource (), false);
+        }
+
         internal void LoadExtensionSources ()
         {
             lock (this) {
@@ -74,13 +82,21 @@
         public void Dispose ()
         {
             lock (this) {
+                // Do not dispose extension sources
+                foreach (Source source in extension_sources.Values) {
+                    RemoveSource (source, false);
+                }
+
+                // But do dispose non-extension sources
                 while (sources.Count > 0) {
-                    Source source = sources[0];
-                    RemoveSource (source);
+                    RemoveSource (sources[0], true);
                 }
                 
                 sources.Clear ();
                 extension_sources.Clear ();
+                active_source =  default_source = null;
+                music_library = null;
+                video_library = null;
                 
                 AddinManager.RemoveExtensionNodeHandler ("/Banshee/SourceManager/Source", OnExtensionChanged);
             }
@@ -138,7 +154,7 @@
             } else if (source is VideoLibrarySource) {
                 video_library = source as VideoLibrarySource;
             }
-            
+
             ServiceManager.DBusServiceManager.RegisterObject(source);
             
             foreach(Source child_source in source.Children) {
@@ -150,7 +166,12 @@
             }
         }
         
-        public void RemoveSource(Source source)
+        public void RemoveSource (Source source)
+        {
+            RemoveSource (source, false);
+        }
+
+        public void RemoveSource (Source source, bool dispose)
         {
             if(source == null || !ContainsSource (source)) {
                 return;
@@ -167,12 +188,14 @@
             sources.Remove(source);
 
             foreach(Source child_source in source.Children) {
-                RemoveSource(child_source);
+                RemoveSource (child_source, dispose);
             }
 
-            IDisposable disposable = source as IDisposable;
-            if (disposable != null) {
-                disposable.Dispose ();
+            if (dispose) {
+                IDisposable disposable = source as IDisposable;
+                if (disposable != null) {
+                    disposable.Dispose ();
+                }
             }
 
             if(source == active_source) {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs	Wed Apr 30 22:26:23 2008
@@ -48,7 +48,7 @@
             try {
                 MigrateLegacyAlbumArt ();
             } catch (Exception e) {
-                Log.Error ("Could not migrate old album artwork to new location.", e.Message);
+                Log.Error ("Could not migrate old album artwork to new location.", e.Message, true);
             }
         }
         

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs	Wed Apr 30 22:26:23 2008
@@ -154,14 +154,14 @@
                 radio_track.ParsingPlaylistEvent += delegate {
                     if (radio_track.PlaybackError != StreamPlaybackError.None) {
                         Log.Error (Catalog.GetString ("Error opening stream"), 
-                            Catalog.GetString ("Could not open stream or playlist"));
+                            Catalog.GetString ("Could not open stream or playlist"), true);
                         radio_track = null;
                     }
                 };
                 radio_track.Play ();
             } catch {
                 Log.Error (Catalog.GetString ("Error opening stream"), 
-                    Catalog.GetString("Problem parsing playlist"));
+                    Catalog.GetString("Problem parsing playlist"), true);
             }
         }
 

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	Wed Apr 30 22:26:23 2008
@@ -283,7 +283,7 @@
                 playlist.Save (Banshee.IO.File.OpenWrite (new SafeUri (uri), true), source);
             } catch (Exception e) {
                 Console.WriteLine (e);
-                Log.Error (Catalog.GetString ("Could not export playlist"), e.Message);
+                Log.Error (Catalog.GetString ("Could not export playlist"), e.Message, true);
             }
         }
 

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs	Wed Apr 30 22:26:23 2008
@@ -53,7 +53,7 @@
             
             if (service == null) {
                 Log.Error (Catalog.GetString ("Could not show preferences"), 
-                Catalog.GetString ("The preferences service could not be found."), true);
+                    Catalog.GetString ("The preferences service could not be found."), true);
                 
                 throw new ApplicationException ();
             }

Modified: trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs	Wed Apr 30 22:26:23 2008
@@ -80,7 +80,7 @@
                 Log.Exception (e);
 				Log.Error (
                     Catalog.GetString ("Error Initializing MTP Device Support"),
-                    Catalog.GetString ("There was an error intializing MTP device support.  See http://www.banshee-project.org/Guide/DAPs/MTP for more information.")
+                    Catalog.GetString ("There was an error intializing MTP device support.  See http://www.banshee-project.org/Guide/DAPs/MTP for more information."), true
                 );
                 throw new InvalidDeviceException ();
 			} catch (Exception e) {
@@ -92,7 +92,7 @@
             if (devices == null || devices.Count == 0) {
 				Log.Error (
                     Catalog.GetString ("Error Finding MTP Device Support"),
-                    Catalog.GetString ("An MTP device was detected, but Banshee was unable to load support for it.")
+                    Catalog.GetString ("An MTP device was detected, but Banshee was unable to load support for it."), true
                 );
             } else {
                 string mtp_serial = devices[0].SerialNumber;

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am	Wed Apr 30 22:26:23 2008
@@ -6,8 +6,8 @@
 SOURCES = Banshee.PlayQueue/PlayQueueSource.cs 
 
 RESOURCES =  \
+	Banshee.PlayQueue.addin.xml \
 	Resources/ActiveSourceUI.xml \
-	Resources/Banshee.PlayQueue.addin.xml \
 	Resources/GlobalUI.xml
 
 include $(top_srcdir)/build/build.mk

Modified: trunk/banshee/src/Libraries/Hyena/Hyena/Log.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena/Log.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena/Log.cs	Wed Apr 30 22:26:23 2008
@@ -319,7 +319,7 @@
         
         public static void Warning (string message, string details)
         {
-            Warning (message, details, true);
+            Warning (message, details, false);
         }
         
         public static void Warning (string message, string details, bool showUser)
@@ -343,7 +343,7 @@
         
         public static void Error (string message, string details)
         {
-            Error (message, details, true);
+            Error (message, details, false);
         }
         
         public static void Error (string message, string details, bool showUser)
@@ -355,6 +355,11 @@
         {
             Error (message, null, showUser);
         }
+
+        public static void ErrorFormat (string format, params object [] args)
+        {
+            Error (String.Format (format, args));
+        }
         
         #endregion
         

Modified: trunk/banshee/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
==============================================================================
--- trunk/banshee/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs	(original)
+++ trunk/banshee/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs	Wed Apr 30 22:26:23 2008
@@ -454,9 +454,7 @@
             } else if (line.StartsWith ("OK")) {
                 success = true;
             } else {
-                Hyena.Log.Error ("Audioscrobbler sign-on failed", 
-                                                  String.Format ("Unknown error: {0}",
-                                                                  line.Trim()), false);
+                Log.Error ("Audioscrobbler sign-on failed", String.Format ("Unknown error: {0}", line.Trim()));
                 hard_failure = true;
             }
             



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