Browse Source

Fixed resume and pause in qBittorrent

pull/523/head
Firdaus Ahmad 5 years ago
parent
commit
d1facac2c1
  1. 24
      app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java

24
app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java

@ -223,7 +223,7 @@ public class QbittorrentAdapter implements IDaemonAdapter { @@ -223,7 +223,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
} else if (version >= 30200) {
path = "/query/torrents";
} else if (version >= 30000) {
path = "/json/torrents";;
path = "/json/torrents";
} else {
path = "/json/events";
}
@ -327,29 +327,34 @@ public class QbittorrentAdapter implements IDaemonAdapter { @@ -327,29 +327,34 @@ public class QbittorrentAdapter implements IDaemonAdapter {
case Pause:
// Pause a torrent
makeRequest(log, "/command/pause", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID()));
if (version >= 40200) {
makeRequest(log, "/api/v2/torrents/pause", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID()));
} else {
makeRequest(log, "/command/pause", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID()));
}
return new DaemonTaskSuccessResult(task);
case PauseAll:
// Resume all torrents
if (version >= 40200) {
path = "/api/v2/torrents/pause";
makeRequest(log, "/api/v2/torrents/pause", new BasicNameValuePair("hashes", "all"));
} else {
path = "/command/pauseall";
makeRequest(log, "/command/pauseall");
}
makeRequest(log, path);
return new DaemonTaskSuccessResult(task);
case Resume:
// Resume a torrent
if (version >= 40200) {
path = "/api/v2/torrents/resume";
makeRequest(log, "/api/v2/torrents/resume", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID()));
} else {
path = "/command/resume";
makeRequest(log, "/command/resume", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID()));
}
makeRequest(log, path, new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID()));
return new DaemonTaskSuccessResult(task);
case ResumeAll:
@ -357,7 +362,7 @@ public class QbittorrentAdapter implements IDaemonAdapter { @@ -357,7 +362,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
// Resume all torrents
if (version >= 40200) {
path = "/api/v2/torrents/resume";
makeRequest(log, path, new BasicNameValuePair("hash", "all"));
makeRequest(log, path, new BasicNameValuePair("hashes", "all"));
} else {
makeRequest(log, "/command/resumeall");
}
@ -527,7 +532,6 @@ public class QbittorrentAdapter implements IDaemonAdapter { @@ -527,7 +532,6 @@ public class QbittorrentAdapter implements IDaemonAdapter {
}
private String makeUploadRequest(String path, String file, Log log) throws DaemonException {
try {

Loading…
Cancel
Save