Browse Source

Allow setting of a folder on Aria2 setups for reverse proxy users. Fixes #397.

pull/424/head
Eric Kok 7 years ago
parent
commit
bcc6fd460f
  1. 12
      app/src/main/java/org/transdroid/daemon/Aria2c/Aria2Adapter.java
  2. 2
      app/src/main/java/org/transdroid/daemon/Daemon.java

12
app/src/main/java/org/transdroid/daemon/Aria2c/Aria2Adapter.java

@ -106,7 +106,7 @@ public class Aria2Adapter implements IDaemonAdapter { @@ -106,7 +106,7 @@ public class Aria2Adapter implements IDaemonAdapter {
buildRequest("aria2.tellStopped", new JSONArray().put(0).put(9999).put(fields));
params.put(active).put(waiting).put(stopped);
List<Torrent> torrents = new ArrayList<Torrent>();
List<Torrent> torrents = new ArrayList<>();
JSONArray lists = makeRequestForArray(log, params.toString());
for (int i = 0; i < lists.length(); i++) {
torrents.addAll(parseJsonRetrieveTorrents(lists.getJSONObject(i).getJSONArray("result")));
@ -322,10 +322,10 @@ public class Aria2Adapter implements IDaemonAdapter { @@ -322,10 +322,10 @@ public class Aria2Adapter implements IDaemonAdapter {
}
private ArrayList<Torrent> parseJsonRetrieveTorrents(JSONArray response) throws JSONException, DaemonException {
private ArrayList<Torrent> parseJsonRetrieveTorrents(JSONArray response) throws JSONException {
// Parse response
ArrayList<Torrent> torrents = new ArrayList<Torrent>();
ArrayList<Torrent> torrents = new ArrayList<>();
for (int j = 0; j < response.length(); j++) {
// Add the parsed torrent to the list
@ -392,7 +392,7 @@ public class Aria2Adapter implements IDaemonAdapter { @@ -392,7 +392,7 @@ public class Aria2Adapter implements IDaemonAdapter {
private ArrayList<TorrentFile> parseJsonFileListing(JSONArray response, Torrent torrent) throws JSONException {
// Parse response
ArrayList<TorrentFile> files = new ArrayList<TorrentFile>();
ArrayList<TorrentFile> files = new ArrayList<>();
for (int j = 0; j < response.length(); j++) {
JSONObject file = response.getJSONObject(j);
@ -420,8 +420,8 @@ public class Aria2Adapter implements IDaemonAdapter { @@ -420,8 +420,8 @@ public class Aria2Adapter implements IDaemonAdapter {
private TorrentDetails parseJsonTorrentDetails(JSONObject response) throws JSONException {
// Parse response
List<String> trackers = new ArrayList<String>();
List<String> errors = new ArrayList<String>();
List<String> trackers = new ArrayList<>();
List<String> errors = new ArrayList<>();
int error = response.optInt("errorCode", 0);
if (error > 0) {

2
app/src/main/java/org/transdroid/daemon/Daemon.java

@ -333,7 +333,7 @@ public enum Daemon { @@ -333,7 +333,7 @@ public enum Daemon {
}
public static boolean supportsCustomFolder(Daemon type) {
return type == rTorrent || type == Tfb4rt || type == Bitflu || type == Deluge || type == DelugeRpc
return type == rTorrent || type == Tfb4rt || type == Bitflu || type == Deluge || type == DelugeRpc || type == Aria2
|| type == Transmission || type == BitTorrent || type == uTorrent || type == qBittorrent || type == Dummy;
}

Loading…
Cancel
Save