Compare commits

..

4 Commits

Author SHA1 Message Date
Eric Kok fd52a57963
Merge pull request #632 from bwitt/qbittorrent-fix-magnet-space 1 month ago
Eric Kok beb2dc350b
Merge pull request #674 from bwitt/bwitt/qb5-start-stop 1 month ago
Brian Witt afcb5223ff use start/stop for qbittorrent 5 1 month ago
Brian Witt a1c367c0e0 Fix stripping space out of links but keep spaces in name intact 2 years ago
  1. 3
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  2. 21
      app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java
  3. 2
      app/src/main/java/org/transdroid/daemon/task/AddByMagnetUrlTask.java

3
app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

@ -985,7 +985,8 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
// Since v39 Chrome sends application/x-www-form-urlencoded magnet links and most torrent clients do not understand those, so decode first // Since v39 Chrome sends application/x-www-form-urlencoded magnet links and most torrent clients do not understand those, so decode first
try { try {
url = URLDecoder.decode(url, "UTF-8"); url = URLDecoder.decode(url.replaceAll("\\s", ""), "UTF-8");
title = URLDecoder.decode(title, "UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
// Ignore: UTF-8 is always available on Android devices // Ignore: UTF-8 is always available on Android devices
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

21
app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java

@ -345,7 +345,9 @@ public class QBittorrentAdapter implements IDaemonAdapter {
case Pause: case Pause:
// Pause a torrent // Pause a torrent
if (version >= 40100) { if (version >= 50000) {
makeRequest(log, "/api/v2/torrents/stop", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID()));
} else if (version >= 40100) {
makeRequest(log, "/api/v2/torrents/pause", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID())); makeRequest(log, "/api/v2/torrents/pause", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID()));
} else { } else {
makeRequest(log, "/command/pause", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID())); makeRequest(log, "/command/pause", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID()));
@ -355,8 +357,10 @@ public class QBittorrentAdapter implements IDaemonAdapter {
case PauseAll: case PauseAll:
// Resume all torrents // Pause all torrents
if (version >= 40100) { if (version >= 50000) {
makeRequest(log, "/api/v2/torrents/stop", new BasicNameValuePair("hashes", "all"));
} else if (version >= 40100) {
makeRequest(log, "/api/v2/torrents/pause", new BasicNameValuePair("hashes", "all")); makeRequest(log, "/api/v2/torrents/pause", new BasicNameValuePair("hashes", "all"));
} else { } else {
makeRequest(log, "/command/pauseall"); makeRequest(log, "/command/pauseall");
@ -367,7 +371,9 @@ public class QBittorrentAdapter implements IDaemonAdapter {
case Resume: case Resume:
// Resume a torrent // Resume a torrent
if (version >= 40100) { if (version >= 50000) {
makeRequest(log, "/api/v2/torrents/start", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID()));
} else if (version >= 40100) {
makeRequest(log, "/api/v2/torrents/resume", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID())); makeRequest(log, "/api/v2/torrents/resume", new BasicNameValuePair("hashes", task.getTargetTorrent().getUniqueID()));
} else { } else {
makeRequest(log, "/command/resume", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID())); makeRequest(log, "/command/resume", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID()));
@ -378,9 +384,10 @@ public class QBittorrentAdapter implements IDaemonAdapter {
case ResumeAll: case ResumeAll:
// Resume all torrents // Resume all torrents
if (version >= 40100) { if (version >= 50000) {
path = "/api/v2/torrents/resume"; makeRequest(log, "/api/v2/torrents/start", new BasicNameValuePair("hashes", "all"));
makeRequest(log, path, new BasicNameValuePair("hashes", "all")); } else if (version >= 40100) {
makeRequest(log, "/api/v2/torrents/resume", new BasicNameValuePair("hashes", "all"));
} else { } else {
makeRequest(log, "/command/resumeall"); makeRequest(log, "/command/resumeall");
} }

2
app/src/main/java/org/transdroid/daemon/task/AddByMagnetUrlTask.java

@ -32,6 +32,6 @@ public class AddByMagnetUrlTask extends DaemonTask {
return new AddByMagnetUrlTask(adapter, data); return new AddByMagnetUrlTask(adapter, data);
} }
public String getUrl() { public String getUrl() {
return extras.getString("URL").replaceAll("\\s", ""); return extras.getString("URL");
} }
} }

Loading…
Cancel
Save