banshee r4510 - in trunk/banshee: . src/Clients/Beroe src/Clients/Beroe/Beroe src/Clients/Halie/Halie src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Collection.Indexer src/Core/Banshee.ThickClient/Banshee.Gui src/Libraries/Mtp
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4510 - in trunk/banshee: . src/Clients/Beroe src/Clients/Beroe/Beroe src/Clients/Halie/Halie src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Collection.Indexer src/Core/Banshee.ThickClient/Banshee.Gui src/Libraries/Mtp
- Date: Wed, 10 Sep 2008 21:04:23 +0000 (UTC)
Author: abock
Date: Wed Sep 10 21:04:22 2008
New Revision: 4510
URL: http://svn.gnome.org/viewvc/banshee?rev=4510&view=rev
Log:
2008-09-10 Aaron Bockover <abock gnome org>
* src/Clients/Halie/Halie/Client.cs: If an IIndexerClient is located
on the bus, tell that client to reboot with any command line arguments
passed, and exit, deferring the invocation
* src/Clients/Beroe/Beroe/IndexerClient.cs: Made a real client, expose
as IIndexerClient on DBus, and support booting into a separate Banshee
process if desired (i.e. someone opens an MP3 file in nautilus while the
indexer client process is running, this still respects the users action)
* src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs: If
--indexer is passed, run the Beroe indexer client assembly
* src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs:
* src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs:
Support shutting down
* src/Core/Banshee.Services/Banshee.Collection.Indexer/IIndexerClient.cs:
Interface for the indexer client with the RebootWhenFinished method
* src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs:
Print some debugging info, use TrackInfo.ExportVersion
* src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs: Added
ExportVersion field
Added:
trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/IIndexerClient.cs
Removed:
trunk/banshee/src/Clients/Beroe/Beroe/Client.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Clients/Beroe/Beroe.csproj
trunk/banshee/src/Clients/Beroe/Makefile.am
trunk/banshee/src/Clients/Halie/Halie/Client.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
trunk/banshee/src/Libraries/Mtp/Mtp.csproj
Modified: trunk/banshee/src/Clients/Beroe/Beroe.csproj
==============================================================================
--- trunk/banshee/src/Clients/Beroe/Beroe.csproj (original)
+++ trunk/banshee/src/Clients/Beroe/Beroe.csproj Wed Sep 10 21:04:22 2008
@@ -45,7 +45,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Compile Include="Beroe\Client.cs" />
+ <Compile Include="Beroe\IndexerClient.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
Added: trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs Wed Sep 10 21:04:22 2008
@@ -0,0 +1,128 @@
+//
+// Client.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using NDesk.DBus;
+using Hyena;
+
+using Banshee.Base;
+using Banshee.Database;
+using Banshee.ServiceStack;
+using Banshee.Sources;
+using Banshee.Collection.Indexer;
+
+namespace Beroe
+{
+ public class IndexerClient : Client, IIndexerClient
+ {
+ public static void Main ()
+ {
+ if (!DBusConnection.ConnectTried) {
+ DBusConnection.Connect ();
+ }
+
+ if (!DBusConnection.Enabled) {
+ Log.Error ("All commands ignored, DBus support is disabled");
+ return;
+ } else if (DBusConnection.InstanceAlreadyRunning) {
+ Log.Error ("Banshee is already running");
+ return;
+ }
+
+ Startup ();
+ }
+
+ private static void Startup ()
+ {
+ ThreadAssist.InitializeMainThread ();
+
+ ServiceManager.Initialize ();
+ ServiceManager.RegisterService<DBusServiceManager> ();
+ ServiceManager.RegisterService<BansheeDbConnection> ();
+ ServiceManager.RegisterService<SourceManager> ();
+ ServiceManager.RegisterService<CollectionIndexerService> ();
+ ServiceManager.RegisterService<IndexerClient> ();
+ ServiceManager.Run ();
+
+ ServiceManager.Get<IndexerClient> ().Run ();
+ }
+
+ private string [] reboot_args;
+
+ public void Run ()
+ {
+ ServiceManager.Get<CollectionIndexerService> ().ShutdownHandler = DBusConnection.QuitMainLoop;
+
+ ServiceManager.SourceManager.AddSource (new Banshee.Library.MusicLibrarySource ());
+ ServiceManager.SourceManager.AddSource (new Banshee.Library.VideoLibrarySource ());
+
+ DBusConnection.RunMainLoop ();
+
+ ServiceManager.Shutdown ();
+
+ if (reboot_args != null) {
+ Log.Debug ("Rebooting");
+
+ System.Text.StringBuilder builder = new System.Text.StringBuilder ();
+ foreach (string arg in reboot_args) {
+ builder.AppendFormat ("\"{0}\" ", arg);
+ }
+
+ // FIXME: Lame
+ System.Diagnostics.Process.Start ("banshee-1", builder.ToString ());
+ }
+ }
+
+ public void Hello ()
+ {
+ Log.Debug ("Received a Hello over DBus");
+ }
+
+ public void RebootWhenFinished (string [] args)
+ {
+ lock (this) {
+ Log.Debug ("Banshee will be started when the indexer finishes");
+ reboot_args = args;
+ }
+ }
+
+ IDBusExportable IDBusExportable.Parent {
+ get { return null; }
+ }
+
+ string IService.ServiceName {
+ get { return "IndexerClient"; }
+ }
+
+ public override string ClientId {
+ get { return "BeroeIndexerClient"; }
+ }
+ }
+}
+
Modified: trunk/banshee/src/Clients/Beroe/Makefile.am
==============================================================================
--- trunk/banshee/src/Clients/Beroe/Makefile.am (original)
+++ trunk/banshee/src/Clients/Beroe/Makefile.am Wed Sep 10 21:04:22 2008
@@ -1,7 +1,7 @@
ASSEMBLY = Beroe
TARGET = exe
LINK = $(REF_BEROE)
-SOURCES = Beroe/Client.cs
+SOURCES = Beroe/IndexerClient.cs
include $(top_srcdir)/build/build.mk
Modified: trunk/banshee/src/Clients/Halie/Halie/Client.cs
==============================================================================
--- trunk/banshee/src/Clients/Halie/Halie/Client.cs (original)
+++ trunk/banshee/src/Clients/Halie/Halie/Client.cs Wed Sep 10 21:04:22 2008
@@ -37,6 +37,7 @@
using Banshee.ServiceStack;
using Banshee.MediaEngine;
using Banshee.PlaybackController;
+using Banshee.Collection.Indexer;
namespace Halie
{
@@ -69,10 +70,19 @@
return;
}
+ IIndexerClient indexer = DBusServiceManager.FindInstance<IIndexerClient> ("/IndexerClient");
+ try {
+ indexer.Hello ();
+ indexer.RebootWhenFinished (Environment.GetCommandLineArgs ());
+ Log.Warning ("The Banshee indexer is currently running. Banshee will be started when the indexer finishes.");
+ return;
+ } catch {
+ }
+
command = DBusServiceManager.FindInstance<DBusCommandService> ("/DBusCommandService");
hide_field = ApplicationContext.CommandLine.Contains ("hide-field");
- bool present = HandlePlayerCommands ();
+ bool present = HandlePlayerCommands () && !ApplicationContext.CommandLine.Contains ("indexer");
HandleWindowCommands (present);
HandleFiles ();
}
@@ -89,7 +99,6 @@
case "show":
case "present": present = true; break;
case "hide": window.Hide (); break;
-
}
}
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs Wed Sep 10 21:04:22 2008
@@ -39,8 +39,13 @@
namespace Banshee.Collection
{
+ // WARNING: Be extremely careful when changing property names flagged with [Exportable]!
+ // There are third party applications depending on them!
+
public class TrackInfo : CacheableItem, ITrackInfo
{
+ public const string ExportVersion = "1.0";
+
public class ExportableAttribute : Attribute
{
private string export_name;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs Wed Sep 10 21:04:22 2008
@@ -119,7 +119,9 @@
public void SaveToXml (string path)
{
lock (this) {
+ uint timer_id = Hyena.Log.DebugTimerStart ();
bool success = false;
+
try {
XmlTextWriter writer = new XmlTextWriter (path, System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;
@@ -130,7 +132,7 @@
writer.WriteStartElement ("banshee-collection");
writer.WriteStartAttribute ("version");
- writer.WriteString ("1.0");
+ writer.WriteString (TrackInfo.ExportVersion);
writer.WriteEndAttribute ();
for (int i = 0; i < model_caches.Count; i++) {
@@ -181,6 +183,8 @@
Log.Exception (e);
}
+ Hyena.Log.DebugTimerPrint (timer_id, "CollectionIndexer.SaveToXml: {0}");
+
SaveToXmlFinishedHandler handler = save_to_xml_finished;
if (handler != null) {
handler (success, path);
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs Wed Sep 10 21:04:22 2008
@@ -37,59 +37,65 @@
{
public class CollectionIndexerService : ICollectionIndexerService
{
- private List<TrackListModel> models = new List<TrackListModel> ();
private string [] available_export_fields;
+ private int open_indexers;
- public void AddModel (TrackListModel model)
- {
- models.Add (model);
+ private Action shutdown_handler;
+ public Action ShutdownHandler {
+ get { return shutdown_handler; }
+ set { shutdown_handler = value; }
}
- public IEnumerable<IDictionary<string, object>> CreateIndex ()
+ public void Shutdown ()
{
- yield break;
- }
-
- public IEnumerable<IDictionary<string, object>> GenerateExportable ()
- {
- foreach (TrackListModel model in models) {
- model.Reload ();
- for (int i = 0, n = model.Count; i < n; i++) {
- yield return model[i].GenerateExportable ();
+ lock (this) {
+ if (open_indexers == 0 && shutdown_handler != null) {
+ shutdown_handler ();
}
}
}
public ICollectionIndexer CreateIndexer ()
{
- return new CollectionIndexer (null);
+ lock (this) {
+ return new CollectionIndexer (null);
+ }
}
internal void DisposeIndexer (CollectionIndexer indexer)
{
- ServiceManager.DBusServiceManager.UnregisterObject (indexer);
+ lock (this) {
+ ServiceManager.DBusServiceManager.UnregisterObject (indexer);
+ open_indexers--;
+ }
}
ObjectPath ICollectionIndexerService.CreateIndexer ()
{
- return ServiceManager.DBusServiceManager.RegisterObject (new CollectionIndexer (this));
+ lock (this) {
+ ObjectPath path = ServiceManager.DBusServiceManager.RegisterObject (new CollectionIndexer (this));
+ open_indexers++;
+ return path;
+ }
}
public string [] GetAvailableExportFields ()
{
- if (available_export_fields != null) {
+ lock (this) {
+ if (available_export_fields != null) {
+ return available_export_fields;
+ }
+
+ List<string> fields = new List<string> ();
+
+ foreach (KeyValuePair<string, System.Reflection.PropertyInfo> field in TrackInfo.GetExportableProperties (
+ typeof (Banshee.Collection.Database.DatabaseTrackInfo))) {
+ fields.Add (field.Key);
+ }
+
+ available_export_fields = fields.ToArray ();
return available_export_fields;
}
-
- List<string> fields = new List<string> ();
-
- foreach (KeyValuePair<string, System.Reflection.PropertyInfo> field in TrackInfo.GetExportableProperties (
- typeof (Banshee.Collection.Database.DatabaseTrackInfo))) {
- fields.Add (field.Key);
- }
-
- available_export_fields = fields.ToArray ();
- return available_export_fields;
}
IDBusExportable IDBusExportable.Parent {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs Wed Sep 10 21:04:22 2008
@@ -38,6 +38,7 @@
[Interface ("org.bansheeproject.Banshee.CollectionIndexerService")]
public interface ICollectionIndexerService : IService, IDBusExportable
{
+ void Shutdown ();
ObjectPath CreateIndexer ();
string [] GetAvailableExportFields ();
}
Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/IIndexerClient.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/IIndexerClient.cs Wed Sep 10 21:04:22 2008
@@ -0,0 +1,42 @@
+//
+// IIndexerClient.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using NDesk.DBus;
+
+using Banshee.ServiceStack;
+
+namespace Banshee.Collection.Indexer
+{
+ [Interface ("org.bansheeproject.Banshee.IndexerClient")]
+ public interface IIndexerClient : IDBusExportable
+ {
+ void Hello ();
+ void RebootWhenFinished (string [] args);
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.csproj Wed Sep 10 21:04:22 2008
@@ -232,6 +232,7 @@
<Compile Include="Banshee.Collection.Indexer\ICollectionIndexer.cs" />
<Compile Include="Banshee.Collection.Indexer\CollectionIndexer.cs" />
<Compile Include="Banshee.Configuration\DefaultApplicationHelper.cs" />
+ <Compile Include="Banshee.Collection.Indexer\IIndexerClient.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Banshee.Services.addin.xml" />
Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am Wed Sep 10 21:04:22 2008
@@ -26,6 +26,7 @@
Banshee.Collection.Indexer/CollectionIndexerService.cs \
Banshee.Collection.Indexer/ICollectionIndexer.cs \
Banshee.Collection.Indexer/ICollectionIndexerService.cs \
+ Banshee.Collection.Indexer/IIndexerClient.cs \
Banshee.Collection/AlbumListModel.cs \
Banshee.Collection/ArtistListModel.cs \
Banshee.Collection/BansheeListModel.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs Wed Sep 10 21:04:22 2008
@@ -65,6 +65,13 @@
Gdk.Global.NotifyStartupComplete ();
return;
}
+
+ // Run the indexer client
+ if (ApplicationContext.CommandLine.Contains ("indexer")) {
+ AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
+ Assembly.GetEntryAssembly ().Location), "Beroe.exe"));
+ return;
+ }
Hyena.Log.InformationFormat ("Running Banshee {0}", Application.Version);
Modified: trunk/banshee/src/Libraries/Mtp/Mtp.csproj
==============================================================================
--- trunk/banshee/src/Libraries/Mtp/Mtp.csproj (original)
+++ trunk/banshee/src/Libraries/Mtp/Mtp.csproj Wed Sep 10 21:04:22 2008
@@ -31,6 +31,8 @@
<Compile Include="Mtp\Folder.cs" />
<Compile Include="Mtp\MtpDevice.cs" />
<Compile Include="Mtp\Track.cs" />
+ <Compile Include="Mtp\AbstractTrackList.cs" />
+ <Compile Include="Mtp\Playlist.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]