Browse Source

Force recheck

pull/407/head
Alon Albert 7 years ago
parent
commit
446ff20087
  1. 16
      app/src/main/java/org/transdroid/daemon/Deluge/DelugeDirectAdapter.java

16
app/src/main/java/org/transdroid/daemon/Deluge/DelugeDirectAdapter.java

@ -66,6 +66,7 @@ import org.transdroid.daemon.task.DaemonTask;
import org.transdroid.daemon.task.DaemonTaskFailureResult; import org.transdroid.daemon.task.DaemonTaskFailureResult;
import org.transdroid.daemon.task.DaemonTaskResult; import org.transdroid.daemon.task.DaemonTaskResult;
import org.transdroid.daemon.task.DaemonTaskSuccessResult; import org.transdroid.daemon.task.DaemonTaskSuccessResult;
import org.transdroid.daemon.task.ForceRecheckTask;
import org.transdroid.daemon.task.GetFileListTask; import org.transdroid.daemon.task.GetFileListTask;
import org.transdroid.daemon.task.GetFileListTaskSuccessResult; import org.transdroid.daemon.task.GetFileListTaskSuccessResult;
import org.transdroid.daemon.task.GetTorrentDetailsTask; import org.transdroid.daemon.task.GetTorrentDetailsTask;
@ -221,12 +222,8 @@ public class DelugeDirectAdapter implements IDaemonAdapter {
return doGetTorrentDetails((GetTorrentDetailsTask) task); return doGetTorrentDetails((GetTorrentDetailsTask) task);
case SetTrackers: case SetTrackers:
return doSetTrackers((SetTrackersTask) task); return doSetTrackers((SetTrackersTask) task);
case SetAlternativeMode:
return notSupported(task);
case GetStats:
return notSupported(task);
case ForceRecheck: case ForceRecheck:
return notSupported(task); return doForceRecheck((ForceRecheckTask) task);
default: default:
return notSupported(task); return notSupported(task);
} }
@ -374,6 +371,12 @@ public class DelugeDirectAdapter implements IDaemonAdapter {
return new DaemonTaskSuccessResult(task); return new DaemonTaskSuccessResult(task);
} }
@NonNull
private DaemonTaskResult doForceRecheck(ForceRecheckTask task) throws DaemonException {
sendRequest(RPC_METHOD_FORCERECHECK, getTorrentIdsArg(task));
return new DaemonTaskSuccessResult(task);
}
@NonNull @NonNull
private List<Torrent> getTorrents() throws DaemonException { private List<Torrent> getTorrents() throws DaemonException {
final Map response = (Map) sendRequest( final Map response = (Map) sendRequest(
@ -734,8 +737,9 @@ public class DelugeDirectAdapter implements IDaemonAdapter {
return (int) o; return (int) o;
} }
// Return an Object so it doesn't confuse our varargs sendRequest methods.
@NonNull @NonNull
private String[] getTorrentIdsArg(DaemonTask task) { private Object getTorrentIdsArg(DaemonTask task) {
return new String[]{task.getTargetTorrent().getUniqueID()}; return new String[]{task.getTargetTorrent().getUniqueID()};
} }

Loading…
Cancel
Save