Browse Source

Fixed compatibility with 3.1 (API version 1)

pull/208/head
Hadley Canine 10 years ago
parent
commit
75d2ac65c4
  1. 12
      app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java

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

@ -193,11 +193,17 @@ public class QbittorrentAdapter implements IDaemonAdapter {
switch (task.getMethod()) { switch (task.getMethod()) {
case Retrieve: case Retrieve:
String path;
if (version >= 30200) {
path = "/query/torrents";
} else if (version >= 30000) {
path = "/json/torrents";
} else {
path = "/json/events";
}
// Request all torrents from server // Request all torrents from server
JSONArray result = new JSONArray(makeRequest(log, JSONArray result = new JSONArray(makeRequest(log, path));
version >= 30200 ? "/query/torrents" :
version >= 30000 ? "/json/torrents" : "/json/events"));
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseJsonTorrents(result), null); return new RetrieveTaskSuccessResult((RetrieveTask) task, parseJsonTorrents(result), null);
case GetTorrentDetails: case GetTorrentDetails:

Loading…
Cancel
Save