[banshee/moblin: 6/11] Get play / stop / PlayURI working - real basics.



commit 68121ffb15688db5da74e009016808ed6041747a
Author: Michael Meeks <michael meeks novell com>
Date:   Fri Aug 7 15:53:53 2009 +0100

    Get play / stop / PlayURI working - real basics.

 .../Banshee.MoblinBackend/MoblinBognor.cs          |   27 ++++++++++++++------
 .../Banshee.MediaEngine/PlayerEngineService.cs     |   12 +++++++++
 2 files changed, 31 insertions(+), 8 deletions(-)
---
diff --git a/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinBognor.cs b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinBognor.cs
index 943c901..a5444db 100644
--- a/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinBognor.cs
+++ b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinBognor.cs
@@ -42,7 +42,7 @@ namespace Banshee.MoblinBackend.BognorRegis
 	public class QueueManager : IDBusExportable, IQueueManager, IDisposable
 	{	
 		// Lame impl. for now.
-		Queue local_queue;
+		LocalQueue local_queue;
 
 		public static IDisposable Init()
 		{
@@ -57,7 +57,7 @@ namespace Banshee.MoblinBackend.BognorRegis
 		public QueueManager()
 		{
 			ServiceManager.DBusServiceManager.RegisterObject (this);
-			local_queue = new Queue(this, "local_queue");
+			local_queue = new LocalQueue(this, "local_queue");
 		}
 		public void Dispose ()
 		{
@@ -76,12 +76,12 @@ namespace Banshee.MoblinBackend.BognorRegis
 	}
 
 	[DBusExportable (ServiceName = "BognorQueue")]
-	public class Queue : IDBusExportable, IQueue, IDisposable
+	public class LocalQueue : IDBusExportable, IQueue, IDisposable
 	{
 		string serviceName;
 		QueueManager mgr;
 
-		public Queue (QueueManager _mgr, string name)
+		public LocalQueue (QueueManager _mgr, string name)
 		{
 			serviceName = name;
 			mgr = _mgr;
@@ -102,10 +102,20 @@ namespace Banshee.MoblinBackend.BognorRegis
 		}
 
 		// methods
-		public void   Play () {}
-		public void   Stop () {}
-		public string GetName () { return "foo"; }
-		public bool   GetPlaying () { return true; }
+		public void Play ()
+		{
+			ServiceManager.PlayerEngine.Play();
+		}
+		public void Stop ()
+		{
+			// FIXME: no stop, hmm !
+			ServiceManager.PlayerEngine.Pause();
+		}
+		public string GetName () { return "local_queue"; }
+		public bool GetPlaying ()
+		{
+			return ServiceManager.PlayerEngine.IsPlaying();
+		}
 
 		public double GetPosition (int type) { return 0.0; }
 		public void   SetPosition (int type, double position) {}
@@ -113,6 +123,7 @@ namespace Banshee.MoblinBackend.BognorRegis
 		public void PlayUri (string uri, string mimeType)
 		{
 			Console.WriteLine ("Play URI " + uri + " type " + mimeType);
+			ServiceManager.PlayerEngine.OpenPlay (new SafeUri (uri));
 		}
 		public void AddUri (string uri, string mimeType) {}
 		public void InsertUri (string uri, string mimeType, int pos) {}
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
index 87af023..8dceece 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
@@ -307,6 +307,18 @@ namespace Banshee.MediaEngine
         {
             OpenPlay (track, true);
         }
+
+        public void OpenPlay (SafeUri uri)
+	{
+            try {
+		OpenCheck (uri, true);
+            } catch (Exception e) {
+                Log.Exception (e);
+                Log.Error (Catalog.GetString ("Problem with Player Engine"), e.Message, true);
+                Close ();
+                ActiveEngine = default_engine;
+            }
+	}
         
         private void OpenPlay (TrackInfo track, bool play)
         {



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