Browse Source

Support setting of labels with rTorrent (thanks tom Briden\!)

pull/11/head
Eric Kok 12 years ago
parent
commit
bc9fdad352
  1. 2
      lib/src/org/transdroid/daemon/Daemon.java
  2. 7
      lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

2
lib/src/org/transdroid/daemon/Daemon.java

@ -255,7 +255,7 @@ public enum Daemon {
} }
public static boolean supportsSetLabel(Daemon type) { public static boolean supportsSetLabel(Daemon type) {
return type == uTorrent || type == BitTorrent; return type == uTorrent || type == BitTorrent || type == rTorrent;
} }
public static boolean supportsSetDownloadLocation(Daemon type) { public static boolean supportsSetDownloadLocation(Daemon type) {

7
lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

@ -55,6 +55,7 @@ import org.transdroid.daemon.task.RemoveTask;
import org.transdroid.daemon.task.RetrieveTask; import org.transdroid.daemon.task.RetrieveTask;
import org.transdroid.daemon.task.RetrieveTaskSuccessResult; import org.transdroid.daemon.task.RetrieveTaskSuccessResult;
import org.transdroid.daemon.task.SetFilePriorityTask; import org.transdroid.daemon.task.SetFilePriorityTask;
import org.transdroid.daemon.task.SetLabelTask;
import org.transdroid.daemon.task.SetTransferRatesTask; import org.transdroid.daemon.task.SetTransferRatesTask;
import org.transdroid.daemon.util.DLog; import org.transdroid.daemon.util.DLog;
import org.transdroid.daemon.util.HttpHelper; import org.transdroid.daemon.util.HttpHelper;
@ -210,6 +211,12 @@ public class RtorrentAdapter implements IDaemonAdapter {
makeRtorrentCall("set_upload_rate", new String[] { (ratesTask.getUploadRate() == null? "0": ratesTask.getUploadRate().toString() + "k") }); makeRtorrentCall("set_upload_rate", new String[] { (ratesTask.getUploadRate() == null? "0": ratesTask.getUploadRate().toString() + "k") });
return new DaemonTaskSuccessResult(task); return new DaemonTaskSuccessResult(task);
case SetLabel:
SetLabelTask labelTask = (SetLabelTask) task;
makeRtorrentCall("d.set_custom1", new String[] { task.getTargetTorrent().getUniqueID(), labelTask.getNewLabel() });
return new DaemonTaskSuccessResult(task);
default: default:
return new DaemonTaskFailureResult(task, new DaemonException(ExceptionType.MethodUnsupported, task.getMethod() + " is not supported by " + getType())); return new DaemonTaskFailureResult(task, new DaemonException(ExceptionType.MethodUnsupported, task.getMethod() + " is not supported by " + getType()));
} }

Loading…
Cancel
Save