From 75d2ac65c4428961dcaa8f647198b65e9c563d54 Mon Sep 17 00:00:00 2001 From: Hadley Canine Date: Mon, 18 May 2015 05:25:59 -0500 Subject: [PATCH] Fixed compatibility with 3.1 (API version 1) --- .../daemon/Qbittorrent/QbittorrentAdapter.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java b/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java index 9fa20836..cb51cee2 100644 --- a/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java +++ b/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java @@ -193,11 +193,17 @@ public class QbittorrentAdapter implements IDaemonAdapter { switch (task.getMethod()) { 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 - JSONArray result = new JSONArray(makeRequest(log, - version >= 30200 ? "/query/torrents" : - version >= 30000 ? "/json/torrents" : "/json/events")); + JSONArray result = new JSONArray(makeRequest(log, path)); return new RetrieveTaskSuccessResult((RetrieveTask) task, parseJsonTorrents(result), null); case GetTorrentDetails: