Browse Source

Fixed qBittorrent 3.2+ (API 2.0+) ratio (and with that the uploaded amount) value. Fixes #212. Also improves leechers/seeder counts.

pull/222/merge
Eric Kok 10 years ago
parent
commit
cd646bcac3
  1. 16
      app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java

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

@ -440,20 +440,30 @@ public class QbittorrentAdapter implements IDaemonAdapter { @@ -440,20 +440,30 @@ public class QbittorrentAdapter implements IDaemonAdapter {
ArrayList<Torrent> torrents = new ArrayList<>();
for (int i = 0; i < response.length(); i++) {
JSONObject tor = response.getJSONObject(i);
int leechers[] = parsePeers(tor.getString("num_leechs"));
int seeders[] = parsePeers(tor.getString("num_seeds"));
double ratio = parseRatio(tor.getString("ratio"));
double progress = tor.getDouble("progress");
int leechers[];
int seeders[];
double ratio;
long size;
int dlspeed;
int upspeed;
if (apiVersion >= 2) {
leechers = new int[2];
leechers[0] = tor.getInt("num_leechs");
leechers[1] = tor.getInt("num_complete") + tor.getInt("num_incomplete");
seeders = new int[2];
seeders[0] = tor.getInt("num_seeds");
seeders[1] = tor.getInt("num_complete");
size = tor.getLong("size");
ratio = tor.getDouble("ratio");
dlspeed = tor.getInt("dlspeed");
upspeed = tor.getInt("upspeed");
} else {
leechers = parsePeers(tor.getString("num_leechs"));
seeders = parsePeers(tor.getString("num_seeds"));
size = parseSize(tor.getString("size"));
ratio = parseRatio(tor.getString("ratio"));
dlspeed = parseSpeed(tor.getString("dlspeed"));
upspeed = parseSpeed(tor.getString("upspeed"));
}

Loading…
Cancel
Save