Browse Source

Fixes #525 labels support for qBittorrent < 4.1

pull/551/head
Eric Kok 5 years ago
parent
commit
39d69ea7ed
  1. 4
      app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java

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

@ -641,14 +641,12 @@ public class QbittorrentAdapter implements IDaemonAdapter { @@ -641,14 +641,12 @@ public class QbittorrentAdapter implements IDaemonAdapter {
Map<String, Label> labels = new HashMap<>();
for (int i = 0; i < response.length(); i++) {
JSONObject tor = response.getJSONObject(i);
if (version >= 40100) {
if (tor.has("category")) {
String label = tor.optString("category");
if (label != null && label.length() > 0) {
final Label labelObject = labels.get(label);
labels.put(label, new Label(label, (labelObject != null) ? labelObject.getCount() + 1 : 1));
}
}
}
return new ArrayList<>(labels.values());
}

Loading…
Cancel
Save