Compare commits

..

12 Commits

Author SHA1 Message Date
Eric Kok b25804d5d7
Merge pull request #625 from bwitt/qbittorrent-show-all-categories 2 years ago
Eric Kok 98dc4bca3f
Merge pull request #626 from bwitt/bitcomet-fix-character 2 years ago
Eric Kok f9b62cf27e
Merge pull request #629 from bwitt/bicomet-add-magnet-url-fix 2 years ago
Eric Kok cc7a73ce56
Merge pull request #631 from bwitt/qbittorrent-set-global-limits 2 years ago
Eric Kok 1a87ae1211
Merge pull request #637 from bwitt/allow-pausing-when-queued 2 years ago
Eric Kok de349784e2
Merge pull request #641 from bwitt/update-gradle-plugin-731 2 years ago
Brian Witt acc818ee6c Update gradle plugin to 7.3.1 2 years ago
Brian Witt 71f3e1b4b5 Allow pausing a torrent when queued 2 years ago
Brian Witt 175249adff BitComet: Update add magnet url 2 years ago
Brian Witt 452927ada4 qBittorrent: Fix setting global upload and download limits 2 years ago
Brian Witt 9e489bc3a9 Remove illegal character from BitCometAdapter.java 2 years ago
Brian Witt 85ef0d51e4 Show all categories on recent qbittorrent 2 years ago
  1. 7
      app/build.gradle
  2. 5
      app/src/main/AndroidManifest.xml
  3. 2
      app/src/main/java/org/transdroid/daemon/Torrent.java
  4. 6
      app/src/main/java/org/transdroid/daemon/adapters/bitComet/BitCometAdapter.java
  5. 31
      app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java
  6. 2
      build.gradle
  7. 2
      gradle/wrapper/gradle-wrapper.properties

7
app/build.gradle

@ -64,9 +64,6 @@ android {
} }
} }
lintOptions {
disable 'MissingTranslation', 'ExtraTranslation', 'StringFormatInvalid', 'ValidFragment', 'Registered'
}
compileOptions { compileOptions {
encoding = 'UTF-8' encoding = 'UTF-8'
@ -75,6 +72,10 @@ android {
} }
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
lint {
disable 'MissingTranslation', 'ExtraTranslation', 'StringFormatInvalid', 'ValidFragment', 'Registered'
}
namespace 'org.transdroid'
} }
dependencies { dependencies {

5
app/src/main/AndroidManifest.xml

@ -15,8 +15,7 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools">
package="org.transdroid">
<uses-sdk /> <uses-sdk />
@ -52,7 +51,7 @@
</queries> </queries>
<application <application
android:name=".core.gui.TransdroidApp_" android:name="org.transdroid.core.gui.TransdroidApp_"
android:allowBackup="true" android:allowBackup="true"
android:banner="@drawable/banner" android:banner="@drawable/banner"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"

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

@ -359,7 +359,7 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
*/ */
public boolean canPause() { public boolean canPause() {
// Can pause when it is downloading or seeding // Can pause when it is downloading or seeding
return statusCode == TorrentStatus.Downloading || statusCode == TorrentStatus.Seeding; return statusCode == TorrentStatus.Downloading || statusCode == TorrentStatus.Seeding || statusCode == TorrentStatus.Queued;
} }
/** /**

6
app/src/main/java/org/transdroid/daemon/adapters/bitComet/BitCometAdapter.java

@ -1,4 +1,4 @@
/* /*
* This file is part of Transdroid <http://www.transdroid.org> * This file is part of Transdroid <http://www.transdroid.org>
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
@ -163,14 +163,14 @@ public class BitCometAdapter implements IDaemonAdapter {
// Request to add a torrent by URL // Request to add a torrent by URL
String url = ((AddByUrlTask) task).getUrl(); String url = ((AddByUrlTask) task).getUrl();
makeUploadUrlRequest(log, "/panel/task_add_httpftp_result", url); makeUploadUrlRequest(log, "/panel/task_add_magnet_result", url);
return new DaemonTaskSuccessResult(task); return new DaemonTaskSuccessResult(task);
case AddByMagnetUrl: case AddByMagnetUrl:
// Request to add a torrent by URL // Request to add a torrent by URL
String magnetUrl = ((AddByMagnetUrlTask) task).getUrl(); String magnetUrl = ((AddByMagnetUrlTask) task).getUrl();
makeUploadUrlRequest(log, "/panel/task_add_httpftp_result", magnetUrl); makeUploadUrlRequest(log, "/panel/task_add_magnet_result", magnetUrl);
return new DaemonTaskSuccessResult(task); return new DaemonTaskSuccessResult(task);
case Remove: case Remove:

31
app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java

@ -234,9 +234,17 @@ public class QBittorrentAdapter implements IDaemonAdapter {
path = "/json/events"; path = "/json/events";
} }
JSONArray result = new JSONArray(makeRequest(log, path)); JSONArray allTorrentsResult = new JSONArray(makeRequest(log, path));
final List<Torrent> torrentsList = parseJsonTorrents(allTorrentsResult);
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseJsonTorrents(result), parseJsonLabels(result)); JSONArray allLabelsResult;
if (version >= 40100) {
allLabelsResult = new JSONObject(makeRequest(log, "/api/v2/torrents/categories")).names();
} else {
allLabelsResult = new JSONArray();
}
final List<Label> labelList = parseJsonLabels(allLabelsResult, allTorrentsResult);
return new RetrieveTaskSuccessResult((RetrieveTask) task, torrentsList, labelList);
case GetTorrentDetails: case GetTorrentDetails:
@ -469,8 +477,8 @@ public class QBittorrentAdapter implements IDaemonAdapter {
String ul = (ratesTask.getUploadRate() == null ? "NaN" : Long.toString(ratesTask.getUploadRate() * 1024)); String ul = (ratesTask.getUploadRate() == null ? "NaN" : Long.toString(ratesTask.getUploadRate() * 1024));
if (version >= 40100) { if (version >= 40100) {
pathDL = "/api/v2/torrents/setDownloadLimit"; pathDL = "/api/v2/transfer/setDownloadLimit";
pathUL = "/api/v2/torrents/setUploadLimit"; pathUL = "/api/v2/transfer/setUploadLimit";
} else { } else {
pathDL = "/command/setGlobalDlLimit"; pathDL = "/command/setGlobalDlLimit";
pathUL = "/command/setGlobalUpLimit"; pathUL = "/command/setGlobalUpLimit";
@ -648,18 +656,25 @@ public class QBittorrentAdapter implements IDaemonAdapter {
} }
private List<Label> parseJsonLabels(JSONArray response) throws JSONException { private List<Label> parseJsonLabels(JSONArray allLabelsResponse, JSONArray allTorrentsResponse) throws JSONException {
// Collect used labels from response // Collect used labels from torrents response
Map<String, Label> labels = new HashMap<>(); Map<String, Label> labels = new HashMap<>();
for (int i = 0; i < response.length(); i++) { for (int i = 0; i < allTorrentsResponse.length(); i++) {
JSONObject tor = response.getJSONObject(i); JSONObject tor = allTorrentsResponse.getJSONObject(i);
if (tor.has("category")) { if (tor.has("category")) {
String label = tor.optString("category"); String label = tor.optString("category");
final Label labelObject = labels.get(label); final Label labelObject = labels.get(label);
labels.put(label, new Label(label, (labelObject != null) ? labelObject.getCount() + 1 : 1)); labels.put(label, new Label(label, (labelObject != null) ? labelObject.getCount() + 1 : 1));
} }
} }
// add unused labels
for (int i = 0; i < allLabelsResponse.length(); i++) {
String label = allLabelsResponse.getString(i);
if (!labels.containsKey(label)) {
labels.put(label, new Label(label, 0));
}
}
return new ArrayList<>(labels.values()); return new ArrayList<>(labels.values());
} }

2
build.gradle

@ -6,7 +6,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.0.3' classpath 'com.android.tools.build:gradle:7.3.1'
} }
} }

2
gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

Loading…
Cancel
Save