banshee r4810 - in trunk/banshee/src/Extensions/Banshee.Torrent: . Banshee.Torrent



Author: alanmc
Date: Sun Nov  9 02:01:17 2008
New Revision: 4810
URL: http://svn.gnome.org/viewvc/banshee?rev=4810&view=rev

Log:
update banshee.torrent to the latest api

Modified:
   trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent.csproj
   trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentFileDownloadTask.cs
   trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentService.cs
   trunk/banshee/src/Extensions/Banshee.Torrent/Makefile.am

Modified: trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent.csproj
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent.csproj	(original)
+++ trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent.csproj	Sun Nov  9 02:01:17 2008
@@ -30,13 +30,13 @@
     <Reference Include="System" />
     <Reference Include="Banshee.Core, Version=1.3.3.0, Culture=neutral" />
     <Reference Include="Banshee.Services, Version=1.3.3.0, Culture=neutral" />
-    <Reference Include="Migo, Version=1.3.3.0, Culture=neutral, PublicKeyToken=null">
+    <Reference Include="Migo, Version=1.4.0.1, Culture=neutral, PublicKeyToken=null">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\bin\Migo.dll</HintPath>
     </Reference>
     <Reference Include="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
     <Reference Include="Hyena, Version=1.3.3.0, Culture=neutral" />
-    <Reference Include="monotorrent-dbus" />
+    <Reference Include="monotorrent-dbus, Version=1.0.3235.2456, Culture=neutral" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Banshee.Torrent.addin.xml" />
@@ -62,4 +62,4 @@
       </Properties>
     </MonoDevelop>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file

Modified: trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentFileDownloadTask.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentFileDownloadTask.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentFileDownloadTask.cs	Sun Nov  9 02:01:17 2008
@@ -35,14 +35,13 @@
 {
 	public class TorrentFileDownloadTask : Migo.DownloadCore.HttpFileDownloadTask
 	{
-		private string torrentPath;
 		private MonoTorrent.DBus.IDownloader downloader;
 		private MonoTorrent.DBus.ITorrent torrent;
 		
 		public TorrentFileDownloadTask(string remoteUri, string localPath, object userState)
 			: base (remoteUri, localPath.Substring(0, localPath.Length - 8), userState)
 		{
-			
+			Console.WriteLine ("Torrent file download task!");
 		}
 		
 		public override long BytesReceived {
@@ -51,7 +50,7 @@
 				if (downloader == null)
                     return 0;
                 
-				return (long)(downloader.Progress / 100.0 * torrent.Size); 
+				return (long)(downloader.GetProgress () / 100.0 * torrent.GetSize ()); 
 			}
 		}
 		
@@ -67,14 +66,16 @@
 
 		public override void ExecuteAsync ()
 		{
+			Console.WriteLine ("Running!");
 			SetStatus (TaskStatus.Running);
 			TorrentService s = (TorrentService) Banshee.ServiceStack.ServiceManager.Get<TorrentService>("TorrentService");
 			downloader = s.Download (this.RemoteUri.ToString(), Path.GetDirectoryName(this.LocalPath));
-			torrent = MonoTorrent.DBus.TorrentService.Bus.GetObject <MonoTorrent.DBus.ITorrent> (MonoTorrent.DBus.TorrentService.BusName, this.downloader.Torrent);
+			torrent = MonoTorrent.DBus.TorrentService.Bus.GetObject <ITorrent> (TorrentService.BusName, this.downloader.GetTorrent ());
 			
 			this.downloader.StateChanged += delegate {
-				if (downloader.State == TorrentState.Seeding)
+				if (downloader.GetState () == TorrentState.Seeding)
 				{
+					Console.WriteLine("Progress");
 					SetProgress(100);
 					SetStatus (TaskStatus.Succeeded);
 					OnTaskCompleted (null, false);
@@ -87,9 +88,11 @@
 				while (base.Progress != 100 && 
 				       (Status == TaskStatus.Running || Status == TaskStatus.Paused || Status == TaskStatus.Running))
 				{
+					
+					Console.WriteLine("Progress");
 					Hyena.Log.Debug ("Torrent Tick");
 					System.Threading.Thread.Sleep (2000);
-					SetProgress((int)downloader.Progress);
+					SetProgress((int)downloader.GetProgress ());
 				}
 			});
 		}

Modified: trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentService.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Torrent/Banshee.Torrent/TorrentService.cs	Sun Nov  9 02:01:17 2008
@@ -52,13 +52,13 @@
         private IEngineSettings settings;
         
         public int MaxDownloadSpeed {
-            get { return settings.GlobalMaxDownloadSpeed; }
-            set { settings.GlobalMaxDownloadSpeed = value; }
+            get { return settings.GetGlobalMaxDownloadSpeed (); }
+            set { settings.SetGlobalMaxDownloadSpeed (value); }
         }
         
         public int MaxUploadSpeed {
-            get { return settings.GlobalMaxUploadSpeed; }
-            set { settings.GlobalMaxUploadSpeed = value; }
+            get { return settings.GetGlobalMaxUploadSpeed (); }
+            set { settings.SetGlobalMaxUploadSpeed (value); }
         }
 
         public string ServiceName {
@@ -75,11 +75,11 @@
             ObjectPath path = engine.RegisterTorrent (torrentUri, savePath);
             IDownloader downloader = bus.GetObject <IDownloader> (BusName, path);
             
-            if (downloader.State == TorrentState.Stopped) {
+            if (downloader.GetState () == TorrentState.Stopped) {
                 downloader.Start ();
-                Console.WriteLine ("Started: {0}", downloader.Path);
+                Console.WriteLine ("Started: {0}", downloader.GetPath ());
             } else {
-                Console.WriteLine ("{0} already running", downloader.Path);
+                Console.WriteLine ("{0} already running", downloader.GetPath ());
             }
             return downloader;
         }
@@ -104,7 +104,7 @@
                 // Get the service and call a method on it to ensure that it is
                 // running and able to answer queries.
                 service = bus.GetObject<ITorrentService> (BusName, ServicePath);
-                service.AvailableEngines ();
+                service.GetAvailableEngines ();
             } catch {
                 Log.Error ("Torrent backend could not be found and could not be auto-started");
                 service = null;
@@ -112,7 +112,8 @@
             }
             
             // Register with Migo so we can handle .torrent downloads
-            Migo.DownloadCore.DownloadManager.Register ("torrent", typeof (TorrentFileDownloadTask));
+            if (!RegisteredInMigo)
+                Migo.DownloadCore.DownloadManager.Register ("torrent", typeof (TorrentFileDownloadTask));
             RegisteredInMigo = true;
             
             // Get the engine from DBus which we will use to download torrents with

Modified: trunk/banshee/src/Extensions/Banshee.Torrent/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Torrent/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Banshee.Torrent/Makefile.am	Sun Nov  9 02:01:17 2008
@@ -7,6 +7,8 @@
 	Banshee.Torrent/TorrentService.cs \
 	Banshee.Torrent/TorrentFileDownloadTask.cs
 
+RESOURCES = Banshee.Torrent.addin.xml
+
 if HAVE_MONOTORRENT_DBUS
 include $(top_srcdir)/build/build.mk
 else



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